Skip to content
Betters Agency

Blog

Power Automate vs Alternatives for JSON Parsing

nbetters · · 18 min read

How to Parse JSON in Power Automate: A Technical Implementation Guide Understanding JSON Parsing in Power Automate The linked Microsoft Learn: Power Platform explains product capabilities and configuration boundaries relevant to this…

How to Parse JSON in Power Automate: A Technical Implementation Guide, a practical guide for Minnesota professional services leaders

How to Parse JSON in Power Automate: A Technical Implementation Guide

Understanding JSON Parsing in Power Automate

The linked Microsoft Learn: Power Platform explains product capabilities and configuration boundaries relevant to this decision. For leaders evaluating the governed operating model, the practical decision is to implement a Power Automate flow that successfully parses JSON data from a given source. JSON (JavaScript Object Notation) is a lightweight, text-based format for structuring data that is both human-readable and easily processed by machines. It serves as a universal language for data exchange between different applications and services. In the context of Microsoft Power Automate, JSON is the primary format for transmitting and receiving data from modern web APIs, cloud services, and many database connectors. When a flow triggers an action,such as receiving an HTTP request, querying a SharePoint list via its REST API, or fetching data from a custom application,the response is often delivered as a JSON string. This raw string, while containing all the necessary information, is not immediately usable within your workflow’s subsequent steps. Parsing JSON is the critical technical process of converting this string into a structured, dynamic object that Power Automate can understand, navigate, and manipulate, enabling you to extract specific values like customer names, order totals, or status codes to drive conditional logic and automate business processes. The importance of this operation cannot be overstated for building robust, scalable automations. Without parsing, the data remains an opaque block of text. The Parse JSON action transforms this text into accessible tokens, allowing you to reference individual data points directly in expressions for other actions. For instance, after parsing a JSON payload from a project management tool, you could use an expression like body('Parse_JSON')?['projectName'] to populate a field in a Dynamics 365 record or send a tailored approval email. The official Microsoft Power Platform documentation underscores this foundational need, as building and managing automations inherently involves handling structured data like JSON to connect agents, apps, and analytics. Mastery of JSON parsing is therefore not a peripheral skill but a core competency for anyone designing flows that interact with external systems, transforming manual data handling into a seamless, digital operation. However, successful parsing is contingent upon a correctly defined schema. The schema acts as a blueprint that tells theParse JSON action what structure to expect: what fields exist, their data types (string, number, boolean, array, or another object), and which are required versus optional. Providing an accurate schema is paramount. If the incoming JSON data deviates from the expected schema,for example, a field arrives as a number when the schema defined it as a string, or a required field is missing,the action will fail, causing the entire flow to stop. This makes understanding JSON’s hierarchical nature (objects {} containing key-value pairs, and arrays [] containing ordered lists) essential before configuration. A practical first step in any implementation is to obtain a sample of the actual JSON output your flow will receive, often by running a test call in an HTTP action and copying the result. This sample is then used to generate the schema directly within theParse JSON action’s interface, ensuring alignment and drastically reducing configuration errors. This process turns a potential point of failure into a reliable gateway for data-driven automation.

Business Process Automation Minnesota: Prerequisites for JSON Parsing

The linked Microsoft Learn: Powerapps Overview explains product capabilities and configuration boundaries relevant to this decision. Before aPower Automate consultant Minneapolis can successfully implement JSON parsing within a client’s workflow, several foundational prerequisites must be verified and established. These are not mere technical formalities but essential guardrails that ensure the automation is reliable, secure, and maintainable. Overlooking these steps is a common source of project delays and flow failures, particularly for organizations in the Twin Cities embarking on their first significant integration efforts. The goal is to move from an ad-hoc script to a governed business process automation Minnesota initiative. The first and most critical prerequisite is access to the correct Power Automate environment and licensing. The user or service account executing the flow must have a Power Automate per-user or per-flow plan that permits the use of premium connectors, as many APIs that return JSON data,such as the SQL Server connector or custom HTTP connectors to internal systems,require these licenses. An administrator must confirm that the necessary Microsoft 365 or Dynamics 365 licenses are assigned and that the user has the "Maker" role in the target environment. Furthermore, for flows that will be triggered by or send data to services outside the Microsoft ecosystem, network security policies must be reviewed. Corporate firewalls in many Minnesota-based enterprises, especially in regulated sectors, may block outbound HTTP requests to unauthorized endpoints. Proactively coordinating with IT security to whitelist specific API URLs prevents runtime failures that are difficult to diagnose after deployment. The second prerequisite is the procurement and validation of a reliable JSON data sample and the accompanying API specifications. You cannot design a parser for unknown data. Abusiness process improvement consultant would typically work with the client’s IT team or software vendor to execute a documented API call that returns a representative success payload. This sample must be captured from the exact system and endpoint the production flow will use. Using hypothetical or outdated samples leads to schema mismatches. With this sample in hand, you can use the "Generate from sample" feature in the Parse JSON action to create an initial schema. However, this is only a starting point. The schema must be meticulously reviewed against the official API documentation to identify optional fields, potential null values, and nested array structures. For instance, an API for inventory levels may return an empty array [] instead of a null value if no stock is available; the schema must account for this to avoid expression errors later in the flow. This due diligence is what separates a fragile prototype from a resilient production workflow. Finally, establishing a clear error-handling and logging strategy is a non-negotiable prerequisite for professional services firms in Saint Paul and beyond. TheParse JSON action will fail if the data does not conform to the schema. Therefore, the flow design must anticipate and manage this failure mode. This involves implementing built-in fault tolerance, such as configuring the action’s "Configure run after" settings to trigger a secondary path if it fails, perhaps to send a notification to an operations team or to write the raw, problematic payload to a secure log (like a SharePoint list or Azure Blob Storage) for forensic analysis. Without this safety net, a single malformed JSON response from an external vendor’s system can silently halt a critical business process. Setting up this diagnostic logging from the outset is a hallmark of maturePower Platform consulting , as it provides the visibility needed to quickly resolve issues and prove the automation’s operational stability to business leaders, turning a technical step into a trusted business procedure.

Implementing JSON Parsing in Power Automate

Successfully parsing JSON data in Power Automate hinges on a structured approach that moves from acquiring the raw data to accessing its individual elements within your workflow. This the governed operating model outlines the core sequence of actions, focusing on the practical steps you will take inside the flow designer. The process typically begins when your flow receives a JSON payload, perhaps from an HTTP request trigger, a SharePoint list item, or another connector. The raw JSON arrives as a string, which Power Automate cannot natively interpret as structured data. Your first task is to transform this string into a usable object using the dedicatedParse JSON action. This action is the cornerstone of the operation, and its correct configuration is critical. You must supply a sample of the expected JSON structure to generate a schema, or you can manually write the schema if you have it. The Microsoft Learn: Getting Started provides foundational context for working with actions and data within the platform, which is essential before manipulating complex data types like JSON. Once theParse JSON action is placed in your flow, you configure it by setting the ‘Content’ field to the dynamic content token representing your JSON string. The ‘Schema’ field is where you define the expected structure. For reliability, using a sample payload to generate the schema is often the best practice. After this action runs successfully, it outputs dynamic content tokens that correspond to the properties defined in your schema. These tokens can then be used in subsequent actions. For instance, if your JSON contains a customerName property, you can directly insert customerName from the Parse JSON output into an email, a Dataverse row, or a variable. This transition from a monolithic string to discrete, accessible data points is the primary goal of the implementation phase. It enables conditional logic based on property values, looping through arrays of objects, and mapping data to other systems. Consider a scenario where a webhook sends project update data in JSON format to your flow. The payload might include an array of tasks, each with properties like taskName, assignedTo, and status. After parsing this JSON, your flow can iterate over the array using anApply to each loop. Inside the loop, you can check if status equals "Overdue" and, if so, send an adaptive card notification to the assignedTo user via Teams. This demonstrates how parsing unlocks advanced automation. Without the Parse JSON step, the flow would only see a single, unreadable text block, making such detailed, property-driven logic impossible. Therefore, your implementation plan should always identify the source of the JSON, insert and correctly configure the Parse JSON action, and then design the subsequent workflow steps around the newly available dynamic content. This structured approach ensures your automation can intelligently react to the data it receives. A critical, often overlooked step is validating that your JSON string is well-formed before the Parse JSON action attempts to process it. A simple way to do this is to use aCompose action to output the raw string first, allowing you to inspect it during a test run. If the JSON is malformed,perhaps due to a missing bracket or a quote from the source system,the Parse JSON action will fail. You can build error handling around this by adding a parallel branch after the action or by configuring the flow’s run-after settings to proceed even if the parsing step fails, logging the error for review. Another common challenge involves nested objects and arrays within the JSON. The schema generated by Power Automate must accurately reflect this nesting to produce the correct dynamic content hierarchy. If your JSON contains an object named invoice with a child property lineItems that is an array, you will need to define that structure in your schema. Once parsed, you can access invoice as an object and then use anApply to each loop to process each item within the invoice/lineItems array. This allows for operations like summing values or checking individual item statuses. Remember, the dynamic content panel will show the properties in a tree structure matching your schema, guiding you to select the right token for invoice/lineItems/quantity or invoice/totalAmount. When integrating with other Power Platform components, such as Power Apps, parsed JSON data becomes the bridge for passing complex information. For example, a flow triggered by a Power Apps canvas app can receive a JSON string from the app, parse it, and then use the extracted data to create or update records in Dataverse. This proposed integration requires explicit configuration; you must map the parsed output tokens to the target connector’s fields. There is no automatic synchronization between parsed JSON properties and other systems,each data movement must be deliberately designed and tested within your flow steps. Following this guide ensures you move from a raw data string to actionable workflow components, forming the basis for reliable, data-driven automation.

Validating and Troubleshooting JSON Parsing

Ensuring your JSON parsing operates correctly requires a methodical validation strategy and an understanding of common failure points. This the governed operating model focuses on practical validation techniques and systematic troubleshooting to transform parsing from a potential point of failure into a reliable foundation for your automation. Validation begins within the flow designer itself, using the built-in test features. After configuring yourParse JSON action, run a manual test of the flow with a known, valid JSON payload. Observe the action’s output; if it succeeds, the green checkmark appears, and the output dynamic content populates. You can then add aCompose action immediately after the Parse JSON step to output the entire parsed object or a specific property. This allows you to inspect the exact data structure Power Automate is working with, confirming that nested objects and arrays are accessible as expected. The Microsoft Power Platform documentation covers the broader platform capabilities for building and managing automations, which inherently includes the importance of testing data transformations as a core reliability practice. A frequent source of parsing failures is schema mismatch. The error "InvalidTemplate. The template language expression ‘…’ cannot be evaluated because property ‘*’ cannot be selected" often indicates the schema does not accurately reflect the incoming JSON. To troubleshoot, verify that your sample schema matches the actual data structure, paying close attention to data types (e.g., string vs. integer) and required properties. Another common issue is receiving malformed JSON, such as a string with trailing commas or incorrect quotation marks, which triggers a parsing error before the action even runs. In such cases, you may need to clean the input string using expressions like replace() or substring() in a Compose action prior to the Parse JSON step. For dynamic data sources, implement error handling by adding a parallel branch after the Parse JSON action using aConfigure run after setting to catch failures. This branch could log the error and the raw payload for analysis, preventing the entire flow from halting unexpectedly. When arrays are involved, a specific validation step is to check the output of the Parse JSON action when the expected property is an array. Use aCompose action to output the array’s length using the length() expression. If the length is zero or the property is null, your subsequentApply to each loop may run zero times or fail, which might be the intended behavior for empty data but could indicate a deeper issue with the data source. For example, if an API response sometimes returns an empty array [] instead of a null value, your schema must account for this possibility. Furthermore, for large or complex JSON payloads, consider whether parsing the entire structure is necessary. You might improve flow performance by using the json() expression function to dynamically access a specific deep property without a full Parse JSON action, though this requires careful syntax and offers no schema validation. To systematically validate parsing logic, create a test harness within your flow. This involves usingCompose actions to log key stages: the raw input string, the output of the Parse JSON action, and the value of critical extracted properties. Compare these logged values against the expected structure from your data source’s documentation. If discrepancies arise, examine whether the issue is a data quality problem from the source or an incorrect schema definition in your flow. For recurring flows, incorporate conditional logic to check for the presence of mandatory fields before proceeding, using a condition like if(not(empty(body('Parse_JSON')?['requiredField'])), true, false). This defensive coding prevents downstream actions from failing due to missing data. Ultimately, systematic validation, testing with representative data, inspecting outputs with Compose actions, and implementing defensive error handling transforms parsing from a potential point of failure into a reliable foundation for your automation. This proactive troubleshooting ensures that when JSON data arrives, your workflow processes it accurately and continues to run smoothly. The process involves iterative testing, schema refinement, and strategic use of expressions to handle edge cases, building resilience directly into your flow’s architecture.

Architecture and Security Considerations

Integrating JSON parsing into a Power Automate flow establishes a critical data processing node within your automation architecture. This node receives, interprets, and routes information, making its design pivotal to the overall security and resilience of your business process. A robust architectural approach considers data lineage, error containment, and compliance boundaries from the outset. The Microsoft Power Platform documentation emphasizes governance and security as foundational concerns, which directly apply to how you handle JSON inputs and outputs in your automations. This guidance is not about product features but about applying disciplined operational principles to your implementation. A primary architectural decision involves defining clear security boundaries for your JSON data flow. Consider the source of your JSON payload: is it an external API, an internal application, or user input from a form? Each source carries different trust levels and potential threat models. For instance, JSON from a public API requires rigorous validation before parsing, as malformed or maliciously crafted payloads can cause flow failures. You should design your flow to validate the schema and content of the JSON before the Parse JSON action executes, using conditional checks or a preliminary "Compose" action to inspect payload structure. This creates a defensive layer that isolates the parsing logic. Furthermore, always map the outputs of the Parse JSON action to clearly defined variables within the flow’s scope. Avoid passing raw, parsed dynamic content directly into actions that perform privileged operations, such as updating a CRM record or sending an email, without intermediate logic to vet the data. From a data governance perspective, you must also consider where the JSON content is processed and stored. Power Automate runs in a Microsoft-managed cloud environment, but the flow’s triggers and connections dictate data residency. If your JSON contains regulated information, you must verify that the flow’s region and all connected services comply with your geographic data sovereignty requirements. An often-overlooked aspect is logging: does your parsed JSON contain personal data that should not be written to the flow’s run history? You can configure your flow to turn off detailed tracking for specific actions, a critical step for compliance with privacy standards. Architecturally, this means segmenting your flow so that sensitive parsing and handling occur in a child flow with restricted logging, which is then called by a parent flow that manages the broader business logic. Operational resilience is another architectural imperative. A flow that parses JSON from an external service should be built to handle that service’s unavailability gracefully. This involves implementing retry policies on the HTTP action that fetches the JSON and designing subsequent parsing steps to check for the existence of expected properties before attempting to use them. A recommended pattern is to wrap the Parse JSON action and its dependent steps inside a scope action, with a parallel error-handling scope configured to catch failures. This containment strategy prevents a single malformed payload from causing a total workflow failure, allowing you to log the error, send a notification, and perhaps route the raw payload to a quarantine location for later inspection. By treating the JSON parsing module as a fault-isolated component, you enhance the overall reliability of your automation. Finally, consider the lifecycle and security of the schema itself. The Parse JSON action requires a JSON schema to interpret the incoming data. This schema is often generated from a sample payload and is embedded within the flow definition. If the source API evolves and changes its JSON structure, your flow will begin to fail. Therefore, a mature architecture includes a validation check or a manual review step whenever the source system is updated. You might also explore whether a shared schema, maintained in a source-controlled repository, can be referenced, though this would require a custom integration step as Power Automate does not natively support external schema references. For a complete the governed operating model, treat the schema as a configuration artifact that requires its own change management process. Regularly audit which flows depend on which external data contracts to understand the impact of upstream changes. This proactive stance transforms your JSON parsing from a simple technical step into a governed, observable component of your automation estate, aligning with the broader governance principles outlined for the Power Platform.

Advanced JSON Parsing Techniques

Moving beyond basic flat structures, real-world integrations often demand parsing complex JSON payloads containing deeply nested objects, arrays of varying lengths, and dynamic property names. These scenarios can challenge the standard Parse JSON action, requiring a deliberate approach to data manipulation within the broader Power Automate ecosystem. The core task is not merely parsing but designing a clear, maintainable method to extract and use the necessary data efficiently. This the governed operating model focuses on techniques for these advanced scenarios. A fundamental technique for managing complexity is to avoid referencing deeply nested paths directly in every action. For instance, if you need a value from response.data.items[0].details.price, you can parse the entire structure but then reshape the data. A recommended workflow is to use a Select action or a Filter Array action after the initial parse. You could parse the payload to obtain an array of items, then use Select to map over that array and output a new, simpler array containing only the price values. This creates a clean, flat data set that is easier to loop over or reference in subsequent steps, reducing errors if the source structure changes. Handling arrays of unknown length requires a shift to iterative logic and defensive checks. After parsing the JSON to access an array property, you should implement a condition before a For each loop. A pattern to consider is checking if the array is empty or null to prevent the loop from failing on invalid data. You can design a condition using an expression like if(equals(length(body('Parse_JSON')?['arrayProperty']), 0), true, false) to gate the loop’s execution. For JSON objects with dynamic property names,where keys are not known in advance,you can parse the object and then use expression functions like keys() to retrieve an array of property names. You can then iterate over this key array to access each corresponding value dynamically, which is essential for processing fluid, configuration-like structures. For highly irregular or large payloads, partial parsing or preliminary string manipulation can be more efficient than parsing the entire document. Before the formal Parse JSON step, you can use a Compose action with functions like split, substring, or json to isolate a specific fragment of the JSON string. For example, if you only require one value from a massive payload, you could extract a substring containing that specific key-value pair and its immediate surrounding braces, then parse only that smaller, valid JSON fragment. This reduces computational load and simplifies your required schema. Another method is to use Data Operations actions to join multiple parsed fragments, constructing a new, simplified JSON object tailored to your downstream process needs. A powerful method for handling polymorphic API responses,where the data field’s structure changes based on a type field,is conditional, hierarchical parsing. You can design a workflow where an initial Parse JSON action parses a top-level envelope to determine the message type or status. Based on that parsed result, your flow can conditionally route the inner payload to a second, more specific Parse JSON action that uses a different, appropriate schema. This modular approach, using flow control like conditions and scopes, creates a more readable and maintainable flow than a single parsing step with a highly complex, conditional schema. When configuring such steps, you must provide a distinct sample payload for each possible schema variant to generate the correct schema template. These advanced techniques converge on a principle of managing complexity by decomposition. Do not force a single schema to describe every variation. Instead, guide the parsing process using flow control, conditions, and loops. Validate each step’s output before proceeding, and critically assess whether full parsing is necessary or if a targeted extraction better serves the workflow’s goal. The supplied Microsoft documentation for Power Automate and the Power Platform provides the foundation for building these automations, but specific implementation patterns require careful design and testing.

Implementation Checklist

  • Isolate Nested Data: Use Select or Filter Array after parsing to flatten deeply nested structures into simpler arrays.
  • Guard Iterations: Implement a condition to check for empty or null arrays before initiating a For each loop.
  • Handle Dynamic Keys: Use the keys() function to obtain an array of property names when JSON keys are not known in advance.
  • Parse Strategically: For large payloads, use string functions to extract relevant JSON fragments before parsing to improve efficiency.
  • Design Conditional Parsing: For polymorphic responses, chain multiple Parse JSON actions within conditional branches based on a top-level type field.

Microsoft Primary Sources

Contact Betters Agency about your next step

Want to talk this through for your business?