I have below string value from which I need a specific section to put in another string. Can someone please help?
String
[{"attributes":{"type":"Call2_vod__c","url":"/services/data/v37.0/sobjects/Call2_vod__c/a0422000000teg5AAA"},"**Name**":"**C-017441978**","Id":"a0422000000teg5AAA"}]
from above string I need to identify Name and fetch immediate data after the next : immediate after Name
In above case, the value is C-017441978
Can someone please help me to do substring this?
Reason
for (Id key : m.keySet()) {
string objectfullname = m.get(key);
Schema.SObjectType targetType = Schema.getGlobalDescribe().get(objectfullname);
if (targetType == null) {
system.debug('Type not found: '+objectFullname);
}
string query = 'SELECT Name FROM '+ objectfullname + ' where Id =\'' + key +'\'' ;
sobject [] records = Database.query(query);
string JSONString = JSON.serialize(records);
recordname.put(key,JSONString);
}
In above code after the JSON.serialize I am getting this error. Any help on above block for different approach is most welcome!