+ Start a Discussion

Erro: The method parse(String) is undefined for the type JSON

Hi All,



DefaultHttpClient client = new DefaultHttpClient();

HttpPost oauthPost = new HttpPost(baseUrl);

HttpResponse response = client.execute(oauthPost);

int code = response.getStatusLine().getStatusCode();

Map<String, String> oauthLoginResponse = (Map<String, String>) JSON.parse(EntityUtils


eclipse show the error The method parse(String) is undefined for the type JSON


plz need help

Platy ITPlaty IT



Check out the documentation on the Apex JSON method, there is no "parse" method- http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_json.htm  I think what you need is one of the deserialize methods there.

Mohith Kumar ShrivastavaMohith Kumar Shrivastava

Sridevi is using JAVA code .Thats surely not apex

Suraj Tripathi 47Suraj Tripathi 47
Hi sridevi,
You can refer the below to know about java JSON parsing.
Link :- https://www.tutorialspoint.com/json/json_java_example.htm

In case you find any other issue please mention. 
If you find your Solution than mark as this as a best answer. 
Thanks and Regards
Suraj Tripathi.