top of page

Do I need the Parse JSON Action in Power Automate?

Updated: Feb 15

Learning JSON (JavaScript Object Notation) is extremely important as it is a way for APIs to communicate between your CRM and ERP systems, like Microsoft Dynamics 365 Sales and Dynamics 365 Business Central. It provides a means to get data fast, in a more readable format, and requires little-to-no coding experience.


Typically, to turn values into selectable, dynamic content, you would use the Parse JSON action. The Parse JSON action can make the flow easier and more convenient, but there are certain scenarios where you wouldn’t want to use it.


Our example today: Power Automate. JSON is used a lot in Power Automate to create greater customization, but there are usage limitations for API requests. Here is some guidance on whether or not you need the Parse JSON action.




Why use Parse JSON?


The Parse JSON action in Power Automate is a powerful tool that allows you to take raw JSON output from an HTTP request for example and turn it into values that can be used as dynamic content for your flow. Parse JSON makes the work of building a flow require less developer skills and is there to make creating flows more convenient. But did you know that it isn’t necessary?


Why wouldn’t I use Parse JSON?


Power Automate has usage limits. Each flow has a limit, as of today, of 5,000 API requests. If you dive deeper into the licensing information, you’ll discover that that doesn’t mean the flow can run 5,000 times because each action in your flow is considered an API request. That means if your flow has 5 actions then you get 1,000 runs per day. That is with the per-user plan. The per-flow plan increases that limit to 15,000 API requests per day.


This means that for every HTTP request action that is paired with a Parse JSON action, you are using twice as many API requests as you might need. Microsoft is unclear whether actions like data operations and variables count towards the API request limit, so for the sake of this article, we are assuming they do.


You can get a flow to run the same without the parse JSON step by using the expressions documented here. Here are a few examples in this video, and explained below.




Referencing a Field Using the Parse JSON Action


Without the Parse JSON action we need to use expressions to reference the field that are in the output of our HTTP request actions. To reference a single value from a single output, not an array, you can leverage the outputs () function. The name of the action goes in-between the parentheses and then the value path is specified between square brackets. I have an example below:

Syntax: outputs(‘Action_Name’)?[‘field’]


Example:


Action Get Books API request: https://www.googleapis.com/books/v1/volumes?q=isbn: ‘9780143126560’

Return body (simplified):

{

"kind": "books#volumes",

"totalItems": 1536

}

To get the total items: outputs(‘Get_Books’)?[‘totalItems’]


If the JSON goes a level deeper you simply separate the value references with a forward slash, e.g. [‘totalItems/field’].


Apply to each


When the data returned is an array an apply to each action is needed and the expressions change. In the apply to each option, you simply need to reference either the body of the request or the JSON field that is the array.

guy typing on a laptop

Example:


Action Get Books API request: https://www.googleapis.com/books/v1/volumes?q=isbn: ‘9780143126560’

Return body (simplified):

{

"kind": "books#volumes",

"totalItems": 1536,

"items": [

{

"kind": "books#volume",

"id": "ebNDDwAAQBAJ"

},

{

"kind": "books#volume",

"id": "WXcHwzaUd4MC”

} ]

}

To get the field kind, first use the apply to each: outputs(‘Get_Books’)?[‘items’]

Then use this to return the kind for each item in the array: items(‘Apply_to_each’)?[‘kind’]

The action name that goes inside the items function is the name of the apply to each step which defaults to Apply to each. Remember to replace the action name in these examples with your own.

To Use, or Not to Use Parse JSON


In a nutshell, the Parse JSON action in Power Automate can be very useful for turning values into dynamic content for your flow, but it’s not the only way to achieve your end goal. If the API request limitations are an issue for you, we have provided the expressions needed to take an alternative route that allows you to get a flow to run the same without the Parse JSON step.


If you have additional questions on the benefits of each approach or need a little extra help understanding which route is best for your organization, you can always reach out to JourneyTEAM. With our experience, we can evaluate your specific use case to advise on whether the Parse JSON action is a necessary part of your flow.

Elevate Processes with JourneyTEAM


Contact us for more information on the benefits of using JSON or Power Automate as part of your processes.

31,283 views

Comentarios


Los comentarios se han desactivado.
bottom of page