Introduction
This article shows how to convert a string to JSON. The JSON Expression can be used to convert a string to JSON quickly.
We can also use the Parse JSON Data Operation by specifying the schema.
Step 1. Enter your username and password to log in to the necessary Power Apps environment at make.powerapps.com, then click on Flows on the left-hand side, as shown in the illustration below.
Step 2. After completing step 1, select New Flow, Instant Flow, and then Manually trigger a flow under the option Choose how to trigger the flow. Then, click Create, as shown in the below diagram.
Step 3. Create a string variable and set its initial value to the JSON object. I've already initialized it. You might obtain this value from the API response during complex flows.
Step 4. By choosing to compose from the Data Operation, add a step.
Step 5. Add the following expression to the inputs and Click OK.
json(variables('JSONString'))
Step 6. As shown below, save the flow and manually test the flow.
Step 7. Clicking Done, as shown in the figure below, after clicking Run Flow, will bring up a list of options below the screen.
Step 8. As we can see, the String is converted to JSON by using the JSON Expression
Step 9. Create the Parse JSON Data Operation Step to convert the String Variable to JSON.
Step 10. Add the JSONString Variable to Content in Parse JSON Data Operation from the Dynamic Content as shown in the screenshot below.
Step 11. Select the Sample JSON Format you want to convert and click the Generate from Schema button on the Parse JSON Step.
Step 12. Repeat Steps 6 & and Step 7 then we can see that String is converted to JSON by using the Parse JSON Data Operation.
Step 13. Add Compose Step and choose the necessary data from the Dynamic content Under Parse JSON to read the Parsed JSON Data.
Step 14. Repeat Steps 6 & and Step 7 then we can read JSON Data.
Summary
In this article, I discussed how we can Convert the String Value to JSON in 2 different ways one is JSON Expression, and the other is Parse JSON Data Operation and Reading the JSON Data.