I am trying to pull the values from a JSON response and have managed to get most of the values except the one I need which is nested in an inner set of curly brackets
public class web_ser {
@future(callout=true)
public static void web_services_rest(String order_JSON){
String payload_JSON = order_JSON;
String endpoint = 'https://some_website.com';
HttpRequest request = new HttpRequest();
Http http = new Http();
request.setEndpoint(endpoint);
request.setMethod('POST');
request.setBody(payload_JSON);
HttpResponse response = http.send(request);
System.debug(response.toString());
System.debug('STATUS: ' + response.getStatus());
System.debug('STATUS_CODE: ' + response.getStatusCode());
String responseJSON = response.getBody();
System.debug('responseJSON: ' + responseJSON);
Map<String, Object> deserialized_JSON_response =
(Map<String, Object>)JSON.deserializeUntyped(responseJSON);
Object message = deserialized_response.get('message');
System.debug('message: ' + message);
}}
The output from message looks something like this:
responseJSON: {"status": "100", "code": "success", "message": "{order_number:00001979,id_number:I-00000982-10}"}
The information I'm trying to pull, id_number, is in the message portion of the deserialized JSON packet:
"message": "{order_number:00001979,id_number:I-00000982-10}"
I am able to to put message into a variable but have been unable to extract the value for the key id_number. What am I missing to be able to access id_number?
dimensions
attribute data - which is similar to what you are requesting above.