I have sample JsonString and need to mapp the json data with salesforce object. Here my developes code,
public class objectMapp
{
//Get id value from the given JSONString
public Results results;
public class Results
{
public string name;
}
public static objectMapp parse(String jsonString)
{
return (objectMapp)JSON.deserialize(jsonString, objectMapp.class);
}
}
Map Code:
public class resultClass
{
public static void getId()
{
String jsonString = '{"count":6176,"next":"https://example.herokuapp.com/objects/recaptures/?page=2","previous":null,"results":[ {"id":"101009","annual_savings":"96613.91","cost":1,},{"id":"101116","annual_savings":"40851.75","cost":1,}}';
objectMapp output = new objectMapp();
output = (objectMapp)JSON.deserialize(jsonString,objectMapp.class);
Member__c objMember = new Member__c();
objMember.Id_Map__c = output.results.name;
insert objMember;
}
}
Getting the above error while debug the code, whats I missed?
Thanks in Advance.