You need to sign in to do that
Don't have an account?
Raksha Narayan
deserialize map<string,list<sobject>> in apex
I have a map, map<string,list<sobject>> mapdata= new map<string,list<sobject>>(); storing the data. the list<sobject> is returning values in JSON format. How to deserialize it?
Try below snippet.
String s = res.getBody();
List<Account> accounts = (List<Account>) JSON.deserialize(s, List<Account>.class);
Review below sample references for more information.
https://developer.salesforce.com/forums/?id=906F00000008r36IAA
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_json.htm
Copy and paste your JSON into http://json2apex.herokuapp.com/ and try the generated code.
Hope above information was helpful.
Please mark as Best Answer so that it can help others in the future.
Thanks,
Vinay Kumar
what is res in this line of code String s = res.getBody(); ?
I was refering to response.
String s = res.getBody(); //res is the response.
Please mark as Best Answer if above information was helpful so that it can help others in the future.
Thanks,
Vinay Kumar