JSON is a lightweight data-interchange format that is very readable and easy to create. This format is what allows an API to communicate with various systems, like Microsoft Dynamics 365 CRM and Dynamics 365 Business Central systems. When you Parse JSON, you’re interpreting that data with the specific language you’re currently using. An example of Parse JSON in use is when you take the raw JSON output data from Power Automate and transform it into values. The values can then be used as content in a dynamic flow.
There are many benefits to using the Parse JSOn action. In addition to making the flow easier and more convenient, it requires little coding experience. You can also use your JSON knowledge to help you integrate various Microsoft Systems like Dynamics 365 Business Central or Dynamics 365 Customer Engagement, Sales, Marketing, Field Service, Supply Chain Management, Human Resources and Customer Service. Finally, the objects you create in JSON match other code objects so if you’re looking to expand in other systems, this knowledge can help make it easier.
However, there are some limitations to using Parse JSON and certain situations when you wouldn’t want to use it.
Situations that Don’t Call for Parse JSON
If you’re using JSON within Power Automate, it’s important to be aware that the system has a usage limit. Currently, Power Automate has a limit of 5,000 API requests. When reviewing the licensing information of the system, it specifies that this doesn’t mean that the JSON flow can run 5,000 times because the system considers every flow as an API request. Rather, every flow has five actions which produces 1,000 runs per day on the per user plan. With the per flow plan, that limit is increased to 15,000 API requests every day.
Every time you request an HTTP action along with a Parse JSON action, you’re doubling the number of API requests and actually create more than you need. As of today, Microsoft has not specified about whether JSON variables or data operations are also included in the API request limit. However, for the purposes of this article, we will assume that they are.
How to Reference a Field Using the Parse JSON Action
If you’re not using the Parse JSON action and you want to reference a field, you would need to use expressions to reference a field located in the output of your HTTP request actions. If you want to refer to a single value from one output rather than an array, you’d have to use the outputs () function. You’d put the name of the action between these parentheses. The value path is specified between square brackets.
Action: Get Books API request https://www.googleapis.com/books/v1/volumes?q=isbn: ‘9780143126560’
Return body (simplified):
If you want the total number of items, you’d use this format: outputs(‘Get_Books’)?[‘totalItems’]
JSON can also go a level deeper by simply separating the value references with a forward slash, e.g. [‘totalItems/field’].
To get data as an array, you need to use the ‘apply to each’ action, which changes the format of the data. With this action, you just need to reference either the JSON field that is the array and the body of the request. Here’s an example:
Action Get Books API request: https://www.googleapis.com/books/v1/volumes?q=isbn: ‘9780143126560’
Return body (simplified):
Finally, if you want to get the field kind, you’ll want to first use the ‘apply to each’ action: outputs(‘Get_Books’)?[‘items’]. Next, you’ll want to use this to return the specific kind for each item in the array: items(‘Apply_to_each’)?[‘kind’]. The specific name that goes inside the items function is the name of the ‘apply to each’ step.
Remember to replace the action name with your own if you’re using these examples in your own system.
Let JourneyTEAM Help You with ParseJSON
Whether you have questions about the information we’ve provided or want to learn more about the benefits of using JSON or Power Automate, contact JourneyTEAM. We’ll provide all the answers to any of your questions.