Hi,
here is looking for a way to iterate over JSON elements that are themselves JSONs.
JSON looks like this:
Solved! Go to Solution.
Hi @in2217 ,
Please try the following method.
Expression reference:
variables('JSONkeys')[items('Apply_to_each')]
Note: Errors may occur because the current traversed property may not exist in JSON. You could ignore the error and set "Configure run after" of Compose action. It should continue to execute when Apply to each success or fails.
Image reference:
Flow run history:
Hope it helps.
Best Regards,
I just figured that I could use Compose action to wrap list of JSON values in an array with array() function:
Hi @in2217 ,
Please try the following method.
Expression reference:
variables('JSONkeys')[items('Apply_to_each')]
Note: Errors may occur because the current traversed property may not exist in JSON. You could ignore the error and set "Configure run after" of Compose action. It should continue to execute when Apply to each success or fails.
Image reference:
Flow run history:
Hope it helps.
Best Regards,
Hi @v-bacao-msft ,
thank you for elaborative suggestion.
Unfortunately it is impractical in my case because there are tens of keys in this original JSON and they are not static - we expect new additions with the time.
In the meanwhile I've come up with solution that would make use xpath function and an ability to iterate over XML elements, thanks to blog post by @John Liu. I'm not done yet, but the schetch goes like this:
1. Wrap original json in root node:
2. Convert to xml:
3. Iterate over XML elements and populate an array of XMLs
4. Iterate over array and populate an array of JSON elements.
Thank you!
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
45 | |
42 | |
36 | |
36 | |
22 |
User | Count |
---|---|
41 | |
31 | |
29 | |
28 | |
26 |