6

I am trying to convert JSON data into a map set, but I tried so hard without any result.

Here is my code

Map<String, String> m {set; get;}

m = (Map <String, String>) JSON.deserializeUntyped(objectA.Data__c);

I keep getting this error

Method does not exist or incorrect signature: [String].deserializeUntyped(String)

What should I do ?

2 Answers 2

17

This is a common problem where a variable (called "json" or "JSON") hides (takes priority as far as the compiler is concerned) the class name. From the error you can see that it is a String variable.

Change the name of that variable and you should be able to reference the static method of the JSON class. Or you can fully qualify the class name by using System.JSON.deserializeUntyped.

0

I also got this error while trying to deserialize the string.Use res.getBody() to deserialize and store in a Object type.

string edurltest='some url';  
string res=JNUtilClass.JNsendReq('GET', edurltest, param.queryStr);  
m=(Map<String,Object>)System.JSON.deserializeUntyped(res.getBody());  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .