+ Start a Discussion
Lukesh KarmoreLukesh Karmore 

how to add Json in map With unique values

This is my code :
String JSONStr = res.getbody();
System.debug('Json String '+res.getbody());
if(res.getstatusCode() == 200 && res.getbody() != null){
List<Object> fmap = (List<Object>)JSON.deserializeUntyped(JSONStr);
System.debug('First Json Map' + fmap);
for(Object o : fmap){
System.debug('Each Object '+ o);


}

}
debug shows duplicate id values but json contain unique Ids
how to store it. 
Thank you
User-added image
Suraj Tripathi 47Suraj Tripathi 47

Hi,

Please find the solution.


String JSONStr = res.getbody();
System.debug('Json String '+res.getbody());
if(res.getstatusCode() == 200 && res.getbody() != null){
 Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(JSONStr);
 system.debug('results::'+results);
 for(String str:results.keySet()){
 system.debug('str::'+results.get(str));
 }
}
    

Please mark it as the best answer so that other people would take references from it.

Thank You