cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JesseW
Frequent Visitor

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
Dual Super User
Dual 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
Dual Super User
Dual 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

Highlighted
JesseW
Frequent Visitor

Re: Issues with Parse JSON function

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

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (7,075)