cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JesseW
Level: Powered On

Issues with Parse JSON function

Hi guys,

 

I am running into issues parsing the following JSON response with a dynamic array id, which in the below example is "697676":

 

{
"superAdjustments": {
"697676": [
{
"notes": null,
"amount": 405.46,
"contributionType": "Employer Contribution",
"id": 321838,
"externalId": null,
"locationId": "174855",
"locationName": "Mkt-023",
"employeeId": "697676",
"employeeName": "Christopher WOOD",
"employeeExternalId": "a3V28000000wnh2EAA"
}
]
},
"payRunId": 3346135
}
 
When I set the Parse JSON schema it hard codes the array id, how can this be set to dynamically update?
 
 
Below is the top of the JSON schema where the array is defined:
2019-06-09_10-05-58.png
 
Below is an example of flow failing due to the response array id, not matching the static array value set within the schema:
 
2019-06-09_10-03-59.png
 
Any guidance would be greatly appreciated, thanks.
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Issues with Parse JSON function

Hi @JesseW 

 

The issue you are seeing is because of the key mentioned in JSON payload and the variable you used in Apply to Each, has the same ID as your payload rather than having the output ID. This can be resolved if you pass correct ID in the Apply to Each input.
 
Please follow the below steps:
 
1) Initialize a variable to store the dynamic ID after the Parse JSON action. 
    Expression: 
split(string(body('Parse_JSON')?['superAdjustments']),'"')[1]
    This gets the dynamic ID.
 
2) Input for the Apply to Each Action with the below formula:
body('Parse_JSON')?['superAdjustments']?[variables('DynamicId')]MicrosoftTeams-image (101).png

Hope this helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Issues with Parse JSON function

Hi @JesseW 

 

The issue you are seeing is because of the key mentioned in JSON payload and the variable you used in Apply to Each, has the same ID as your payload rather than having the output ID. This can be resolved if you pass correct ID in the Apply to Each input.
 
Please follow the below steps:
 
1) Initialize a variable to store the dynamic ID after the Parse JSON action. 
    Expression: 
split(string(body('Parse_JSON')?['superAdjustments']),'"')[1]
    This gets the dynamic ID.
 
2) Input for the Apply to Each Action with the below formula:
body('Parse_JSON')?['superAdjustments']?[variables('DynamicId')]MicrosoftTeams-image (101).png

Hope this helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

JesseW
Level: Powered On

Re: Issues with Parse JSON function

Brilliant thank you so much @yashag2255. This is now working as expected!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 347 members 4,642 guests
Please welcome our newest community members: