keys() is undefined for the type JSONObject

Why do i get this error when i'm trying to get the keys of JSONObject ?
its clearly in the API

And I'm importing the correct library :

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

I saw an example of usage and it is working for them .
this is part of my code where i get the error :

JSONArray pObject = (JSONArray) srcClaims.get(i);
for (int j=0; j < pObject.size() ; j++) {
    JSONObject mainsnak = (JSONObject) pObject.get(j);
    mainsnak.keys();

And i forgot to mention the libray i'm using json-simple-1.1.1.jar.

Jon Skeet
people
quotationmark

You're looking at the documentation for the wrong library. In json-simple, JSONObject extends HashMap, so you should use keySet()... or change to use the json.org library instead.

people

See more on this question at Stackoverflow