I get a JSON response from external system in the resposne.body()
The JSON looks like this:
"[{\"workOrderNumber\":\"WO-02612\",\"workOrderId\":\"a3F5C000000LHB0UAO\",\"processingStatus\":\"Open\"}]"
I created a class in my org to deserialize the json.
public class ResponseJSON{
public String sampleNumber;
public String SampleID;
public String state;
}
I did get an error when deserializing the json saying it's a Malformed JSOn because '{'
is missing, so it wasn't the correct JSON format. So added the '{'
and '}'
in the beginning and end of JSON when deserializing the JSON.
ResponseJSON respJson =(ResponseJSON)JSON.deserialize('{' + response.getBody() + '}', ResponseJSON.class);
But this gives me an error:
"common.apex.runtime.impl.ExecutionException: Unexpected character ('}' (code 125)): was expecting a colon to separate field name and value at {the above line}
What am I missing here?