Partial deserialize JSON

Hi everyone,

I have included an image which contains the body response of a REST call. This response is a batch call. So it includes multiple responses in the body. And as you can see it contains a different body depending on the http status code. With the response we want to start a process for each response in the array of responses in order to update the database as quick as possible with the response status codes and the messages that is included in the body.

So my idea was deserializing the full response list as a list of text and starting for each text in the list as a process with the text as input parameter. But I'm getting an error when trying to deserialize the JSON text into a list of text.

The error says "Failed to deserialize JSON to BatchResponses_All:
Unexpected character encountered while parsing value: {. Path 'responses', line 1, position 15. "

Is there anyway I can deserialize specific parts of a JSON text? Thanks in advance.


Hi Bo,

Yes it should be possible if the json content has been parsed correctly. Also I don't think this would be optimal given your constraints.

Can you include your oml so we start fixing/discussing around your code to see what we can improve?

Thank you

Hello Bo,

Check out this forge component that was recently created. Basically, you provide the Json and Json xpath as input to the component and it will fetch you the required set of result in the form of record list.

For e.g. in your case if you provide the json (as per your attachment) with an xpath value of "$...code" then you can retrieve a list of all error codes. 

Screenshots from the 'Try Now' feature available for the component:

Similarly to retrieve a list of error messages, the xpath supplied would be "$...message" (or $..body.error.message but you get the idea):

I hope this helps some,



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.