Several Encodian actions return JSON data, and before that data can be consumed and used within Power Automate, it must be parsed. This post aims to provide precise guidance/detail on how this can be achieved.
This article is relevant for the following Encodian actions, and the steps to parse the JSON payload can be applied to all.
The article also covers handling large and small JSON payloads, as the process required to run them differs slightly.
Parsing JSON – Small Payload
Consider the following simple Flow, which parses a relatively small CSV file, and once parsed, I’d like to add the data to a SharePoint list.
Before I can use the data returned by the ‘Parse CSV‘ action, I need to parse it by following these simple steps.
1. Execute the Flow and then select the Encodian action
2. Select the data which needs to be parsed. For this action, it is the ‘CSV Data‘ property
ALERT: If the Encodian action has returned a large data set, Flow may display the result as per the image below. If this happens, please review the steps within this post’s ‘Parsing JSON – Large Payload’ section.
3. Add a ‘Parse JSON‘ action to your flow
3.a. Content: Select the relevant value from the Encodian action containing data which needs to be parsed
3.b. Click ‘Generate from sample.‘
3.c. Copy and paste the value obtained in step #2, and click ‘Done.‘
ALERT: In some circumstances, the data returned by the Encodian action may be displayed within Power Automate as an escaped JSON string, and you may experience the following error. Please review the ‘Escape JSON‘ section of this document which explains how to resolve it.
3.d. The schema has now been generated, allowing you to work with the data returned by the Encodian action as dynamic data.
The screenshot below shows the parsed CSV data in Power Automate dynamic data:
Parsing JSON – Large Payload
Consider the following simple Flow, which is extracting text from a large PDF file which is also returned within the payload:
Before I can use the data returned by the ‘Extract Text from Regions‘ action, I need to parse it by following these simple steps.
1. Execute the Flow, select the Encodian action, and click ‘Click to download.‘
2. This will download the raw JSON returned by the Encodian action. Your browser will govern how this will be displayed. By default, Chrome will render the file as:
This can make working with the JSON pretty tricky! We’d recommend adding a JSON viewer extension such as JSON Formatter to help.
3. Locate the value which you wish to parse. In this example, we’re going to parse the ‘TextRegionResultsSimple‘ value:
4. You may have noticed that the JSON has been escaped and contains the following characters in front of the speech marks \. Before the JSON can be parsed, it must be unescaped. Please follow the steps within the ‘Escape JSON‘ section
5. Add a ‘Parse JSON‘ action to your flow
5.a. Content: Select the relevant value from the Encodian action containing data which needs to be parsed
5. c. Copy and paste the escaped JSON value obtained in step #4, and click ‘Done.‘
5.d. The schema has now been generated, allowing you to work with the data returned by the Encodian action as dynamic data.
Escaping a JSON string is super simple! There are lots of online tools available such as Code Beautify
We hope this post provides the extra guidance needed to parse the JSON returned by Encodian actions correctly. If you’re struggling, please raise a ticket with our support team, who’ll be delighted to help.
We hope you’ve found this post useful. As ever, please share any feedback or comments. All are welcome!