JSON is not valid

I am getting a “Your JSON is not valid” error and my flow is getting stuck at the Enrich API stage. I am running the flow on a dataset with 20k rows, which was too big so I split it up into 8 smaller datasets. 7 of those smaller datasets ran perfectly with no issue but one of the subsets keeps giving me that error. I’m assuming it is some character in my dataset that is breaking it but how do I find out which one? I need special characters like " and & in the output so I can’t just remove all special characters.

Hi @ANDREW_PEREZ,

The cause of this JSON error message is likely due to the quote characters "" since they throw JSON structure off. (JSON interprets quotes as the field ending, so if a word is wrapped in quotes mid-sentence during a row value, this will cause a JSON structure issue.) Data being merged that have quotes in them need escaping. Before the step Enrich with an API, connect your flow to Find and replace to change quotes from " to \" for escaping and fixing the error.



If you’re ending your flow with an export that generates a file like the step Use CSV file, then you can place another Find and replace step after Enrich with an APIs to remove the escaping if preferred. However, if you’re ending your flow by exporting data to another API via Send to an API, then the quotes would still need to be escaped.