Search

Parse JSON: What is it and Why do I Need it? (Power Automate)

JavaScript Object Notation (JSON) is a lightweight format for data storage and is what an API uses to communicate data between systems, particularly between Microsoft CRM, Microsoft Dynamics 365, and Business Central Systems. For example, within Power Automate, the Parse JSON action takes the raw JSON output data and transforms into values. These values can then be used as content for your dynamic flow.

The benefits of Parse JSON makes building a flow much easier and more convenient as it requires very little coding skill. And if you’re looking to integrate Microsoft systems, like Dynamics 365 or Business Central, knowing how to use the Parse JSON tool is extremely important. Plus, this skill can also be used with several other tools with a little more customization code, but knowing JSON makes the expansion easier.

However, there are times when using the Parse JSON tool isn’t always necessary.





When Parse JSON Shouldn’t be Used

Power Automate puts a limit on usage. As of today, every flow has a limit of 5,000 API requests. A closer look at the licensing information shows that this doesn’t mean that the flow can run 5,000 times because the system considers every flow action an API request. This means that if a flow has five actions, you’ll get 1,000 runs per day with the per user plan. On the other hand, the usage limit is increased to 15,000 API requests per day with the per flow plan.

For every requested HTTP action joined with a Parse JSON action, the number of API requests you’re using is doubled, which could be more than you actually need. Currently, Microsoft has been unclear about whether variables or data operations are included in the API request limit, but for the purpose of this article, it is assumed they are.

To see how to get a flow to run without the Parse JSON steps, use the expressions that are documented here or view the examples below.


Referencing a Field Using the Parse JSON Action

Without the Parse JSON action, we would need to use expressions to reference the fields located 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 between the parentheses and then the value path is specified between square brackets.


For example:

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

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’].


When the data is returned as an array, an ‘apply to each’ action is needed, which changes the expressions. In the ‘apply to each’ action, you simply need to reference either the body of the request or the JSON field that is the array.


The example below illustrates this:

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, you’ll first use the apply to each action: outputs(‘Get_Books’)?[‘items’]

Next, you’ll use this to return the kind for each item 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’. When using these examples, don’t forget to replace the action name with your own.


Contact JourneyTEAM for Additional Information on JSON

If you have any questions regarding the information above or you want to learn more about using either Power Automate or JSON, contact a JourneyTEAM representative. We’ll show how to effectively use JSON in your Power Automate software and provide answers to any questions you might have. Contact us today!

JourneyTEAM was recently awarded Microsoft US Partner of the Year for Dynamics 365 Customer Engagement (Media & Communications) and the Microsoft Eagle Crystal trophy as a top 5 partner for Dynamics 365 Business Central software implementations. Our team has a proven track record with successful Microsoft technology implementations. We have experts ready to answer your questions about the latest Power BI updates and how it helps your ERP business activities. Contact JourneyTEAM today!


833-438-2312
info@journeyteam.com

CORPORATE OFFICE UTAH

121 W Election Rd #300

Draper, UT 84020

--------

Nashville, TN

Salinas, CA

Houston, TX

Pittsburgh, PA

Concord, NH

High Point, NC

Baltimore, MD

Louisville, KY

St. Louis, MO

Waukesha, WI

VAR_Star_logo White.png

VAR STARS
2020 WINNER

  • White LinkedIn Icon
  • White Instagram Icon
  • White Facebook Icon
  • White YouTube Icon
  • White Twitter Icon

Microsoft Dynamics 365, SharePoint, Cloud, ERP, Field Service, Business Central, CRM and Marketing Consultant in Utah and Tennessee. Microsoft Gold Partner and Okta top 20 World-Wide Partner. © 2020 JourneyTEAM. All Rights Reserved. Privacy Policy Terms and Conditions