I am calling a REST endpoint (of another Salesforce instance) and I am getting the following response:
[{
"attributes": {
"type": "Job__c",
"url": "/services/data/v29.0/sobjects/Job__c/a03e0000004AZfcAAG"
},
"Web_Scribble_Record_Link__c": "http://www.google.com",
"Organization_Type__c": "Ed Support Org - Education Technology",
"Job_Type__c": "Job Type - Field",
"Position_Type__c": "Full-Time",
"Experience_Level__c": "2 - 5 Years",
"Job_State__c": "CA",
"Employer_State__c": "California",
"Employer_Name__c": "Joes Town Inc",
"Employer_City__c": "Los Angeles",
"Application_Link__c": "http://www.myapplink.com",
"Organization__c": "001e000000PBP4oAAH",
"Id": "a03e0000004AZfcAAG",
"Job_Title__c": "Director of Events",
"Job_City__c": "Brea"
}, {
"attributes": {
"type": "Job__c",
"url": "/services/data/v29.0/sobjects/Job__c/a03e0000004AZqkAAG"
},
"Web_Scribble_Record_Link__c": "http://www.yahoo.com",
"Organization_Type__c": "Government Ed Agency - State",
"Job_Type__c": "Job Type - Field",
"Position_Type__c": "Part-Time",
"Experience_Level__c": "Less than 2 Years",
"Job_State__c": "CA",
"Employer_State__c": "California",
"Employer_Name__c": "Joes Town Inc",
"Employer_City__c": "Los Angeles",
"Application_Link__c": "http://www.myapplink.com",
"Organization__c": "001e000000PBP4oAAH",
"Id": "a03e0000004AZqkAAG",
"Job_Title__c": "Sr. Director of Fun",
"Job_City__c": "Brea"
}]
The object from the remote instance is not present in my Salesforce instance so I want to cycle through the values and map them to a different object / fields in my instance.
If I strip out the square braces on the beginning / end I can use the following code:
Map<String, Object> m =
(Map<String, Object>)
JSON.deserializeUntyped(ERS);
The problem is that I think the map is not seeing two separate objects. So I think i am only getting one of the two results. Perhaps I need to feed the results into a list and then iterate them into the map but not sure how that syntax should look.