JSON Parser Step Error - Flow Designer

Rachna S
Tera Guru

Hi,

How do I use JSON parser step in flow designer along with 'REST' response saved as attachment ?

So I am making a Get REST call and saving the JSON response as a .txt attachment in servicenow. I'd like to use JSON parser step after this to parse response saved in the attachment. I'm looking up for the attachment and passing it to JSON parser step. However, it throws an error stating this 'JsonParserOperation failed: Extraction of Complex Object failed: JsonStreamParser[0]: JSON must be an object or an array: '4' com.glide.transform.transformer.exceptions.InvalidStructureException'

Please advise.

9 REPLIES 9

Thanks for the update.

Please close the question by marking your own response as correct

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

what was the solution then

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

Can you show the configuration please?


Thanks,
Ashutosh

Hi Ashutosh,

I've figured this out. It threw error only when I used MID server to make a REST call. Thank you though.

 

Cheri
Tera Contributor

In case anyone else comes up against this error or similar, this is either due to hitting a limit within Flow Designer, causing the JSON to get cut off mid string, making it invalid structure during parsing OR you're hitting an error (ex: 400, 503, etc.), hence the first digit in the error message. Check your resource path.

 

The solution I implemented was to create a Data Stream instead of a basic Action. Data streams are currently only available for those who have the IntegrationHub Enterprise licensure and plugin installed, but it appears to be the best way to handle big REST calls. This also reduced flow run time from ~3 hours to 7 minutes.

 

Link to course on Data Stream Actions

 

If you don't have IntegrationHub Enterprise, you may need to reduce the amount of data you're handling or explore alternative ways to retrieve and parse it.