Power Automate Parse JSON Error: 3 Proven Ways to Fix Invalid JSON

Power Automate Parse JSON error fix tutorial

Example of the Parse JSON error

Power Automate Parse JSON error is a common issue when working with HTTP responses and APIs.

This problem usually happens when the schema defined in the Parse JSON action does not match the structure of the JSON returned by the request.

In this guide, we will explain why the Power Automate Parse JSON error happens and how you can fix it step by step.

You may see an error similar to this when the schema does not match the JSON response:

Why the Power Automate Parse JSON error happens

This error usually occurs when the schema defined in the Parse JSON action does not match the structure of the JSON returned by the HTTP response.

In Power Automate, the Parse JSON expects the data to follow the same schema defined in the flow. If the structure or data are different, the flow will fail.

Common causes of this error included:

  • Data types that do not match the schema.
  • Null values that are not expected in the schema.
  • An incorrect or outdated schema.

How to fix the Parse JSON error

Below are some common ways to fix this issue.

Fix 1: Validate the JSON structure

Before using the Parse JSON action, make sure that your JSON payload is valid.

You can validate your JSON using tools like:

https://jsonlint.com

These tools help you detect formatting problems or structural issues in the JSON response.

Fix 2: Generate the correct schema

A recommended practice is to generate the schema directly from a real JSON response.

In the Parse Jason action, select:

Use sample payload to generate schema.

Then paste a valid examp[le of the JSON returned by your API or HTTP request.

This ensure that the schema matches the actual structure of the data.

Fix 3: Handle null values

Another common issue occurs when the API returns null values, but the schema does not allow them.

If a property may contain null vallues, the schema should allow both the expected type and null.

For example:

This configuration allows the property to contain either a string or null value.

Best practices for Parse JSON in Power Automate

To avoid errors when using Parse JSON, follow these best practices:

  • Validate your JSON before parsing it.
  • Generate the schema using real response data.
  • Handle possible null values in the schema.
  • Update the schema if the API response changes.

Conclusion

The Power Automate Parse JSON error is easy to fix once you understand how schemas and JSON structures work.

By validating the JSON payload, generating the correct schema, and handling null values properly, you can prevent most Parse JSON issues and make your flows more reliable.

2 comentarios en “Power Automate Parse JSON Error: 3 Proven Ways to Fix Invalid JSON”

  1. Jose Luis Ferrigno

    Hello! thanks for this article, is a life saver for rookies like me trying to get into Power Automate, but I do have some questions about this based on my own experience. Care to take a look at them and if possible help a dev out?

    1) Is the issue intermittent or constant? Does it happen with specific data or all data?

    2) Can you show an example of the payload that triggers the error (with sensitive info removed)?

    3) Could the payload include optional or missing properties? Did you update the schema to allow that?

    4) Did you use json() or string() in expressions before parsing?

    Thank you, and hope you upload another post soon. New follower for sure.

    1. Hello Jose Luis,
      Thank you for your questions and for following the blog!
      1. The issue is usually intermittent and happens when specific scenarios occur, such as when the payload structure changes or when a property contains a null value that is not allowed in the schema.
      2. The payload can vary depending on the scenario. In many cases, the error appears when the response contains unexpected values or missing properties.
      3. Yes, updating the schema to allow optional or null properties usually resolves the issue. For example, allowing both “string” and “null” types for certain fields.
      4. In this case, I only used the Parse JSON action directly. However, in some scenarios, using expressions like json() can help when the input is received as a string.
      Thanks again for your comment, and I’m glad you found the post helpful. More Power Automate troubleshooting guides will be coming soon!

Dejar un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Scroll al inicio