How to Parse JSON in Power Automate

Loading

Overview

Parsing JSON in Power Automate allows you to extract data from API responses, Power Apps inputs, or other sources. The “Parse JSON” action converts JSON into structured data that can be used in conditions, loops, and other actions.

When to Use “Parse JSON” in Power Automate?

Extracting data from API responses
Parsing JSON data from Power Apps
Handling JSON content from Microsoft Forms, SharePoint, or OneDrive
Using JSON data in variables, conditions, or loops


1️⃣ Understanding JSON Structure

JSON (JavaScript Object Notation) is a structured format with key-value pairs.

Example JSON Response (API)

jsonCopyEdit{
  "user": {
    "id": 1,
    "name": "John Doe",
    "email": "john@example.com"
  }
}

Example JSON Array (Multiple Items)

[
{
"id": 1,
"name": "John Doe",
"email": "john@example.com"
},
{
"id": 2,
"name": "Jane Smith",
"email": "jane@example.com"
}
]

2️⃣ Steps to Parse JSON in Power Automate

Step 1: Add the “Parse JSON” Action

  1. Open Power Automate
  2. Create a new flow (Manual, Automated, or Scheduled)
  3. Add an action: “Parse JSON”

Step 2: Configure the “Parse JSON” Action

The “Parse JSON” action needs:
The Content (JSON data to be parsed)
A Schema (Defines the JSON structure)

Example: Parsing API Response

FieldValue
ContentBody (from previous API action)
SchemaAuto-generated using a sample JSON

Step 3: Generate JSON Schema Automatically

  1. Click “Generate from sample” in the “Parse JSON” action
  2. Paste a sample JSON response
  3. Click “Done” to auto-generate the schema

Example Generated Schema

{
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"email": { "type": "string" }
}
}
}
}

3️⃣ Using Parsed JSON Data in Power Automate

Once parsed, the JSON data can be used dynamically.

Example: Extract User Email

  • Use Dynamic Contentuser email
  • Add an action: “Send an Email”
    • To: user email (from parsed JSON)
    • Subject: "Welcome, user name!"

Example: Loop Through JSON Array

If the JSON contains an array, use “Apply to Each”:

JSON InputAction
Body from APIParse JSON
Parsed JSON (Array)Apply to Each
Inside LoopUse Dynamic Content (e.g., name, email)

Example: Send an email to multiple users from API response

  1. Trigger: Get users from API
  2. Parse JSON
  3. Apply to Each (Users List)
  4. Send an Email (To: user email)

4️⃣ Best Practices for Parsing JSON in Power Automate

Always Generate Schema – Avoid manual JSON schema creation.
Use “Try-Catch” for Errors – Handle errors when parsing JSON using “Scope” with “Configure Run After”.
Validate JSON Before Parsing – Use a Condition action to check if JSON is valid.
Use “Apply to Each” for Arrays – Loop through JSON arrays properly.
Test with Sample Data – Ensure your schema matches the expected JSON format.

Leave a Reply

Your email address will not be published. Required fields are marked *