Convert String to JSON using Power Automate Microsoft Flow | Work with Parse JSON

Convert a string having the JSON content to JSON object using Power Automate Microsoft Flow (MS Flow). We will work with the JSON Object and not the JSON Array.

Initialize a string variable having the JSON object as its value. I am initializing it upfront. During complex flows, you might get this value from the API response.

Initialize a string json variable with JSON object as its value

Add a Compose step with Inputs having the below Expression.

json(variables('jsonString'))
Compose step to convert string to JSON object

The output of this Compose step is a JSON object which you can use anywhere in the flow. For this demo, I am saving the Compose output to an Object variable.

Initialize object variable with value as output of Compose

Run the flow and see the output.

Output of converting string to JSON object using Power Automate Microsoft Flow

If your intention is to get the value from the JSON. You can work with Parse JSON to extract the value using the schema. Generate the schema using the sample JSON payload.

generate schema to parse JSON

In Parse JSON step, I am directly using the string variable. The output of this Parse JSON will generate the variables according to the properties defined in the schema.

Parse JSON to extract values from the JSON

I am using the variable generated by the Parse JSON in the Compose step.

Compose step using the variable generated by Parse JSON

Run the flow and see the output.

Output of Compose step with the values of the JSON properties

Thank you All!!! Hope you find this useful.


Leave a Reply

Up ↑

Discover more from JD Bots

Subscribe now to keep reading and get access to the full archive.

Continue reading