cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Transforming JSON

Hi guys and girls,

I am currently struggling to do some transformation. 

I have a JSON array that is as follows and I want to get to the one on the right:image.png

 

 

So far the flow looks basically as this: 
https://sergeluca.wordpress.com/2018/10/28/microsoft-flow-advanced-tutorial-creating-a-csv-converter...

I am trying to get a csv readable for an approval flow. So with this flow I will just convert the csv porvided by a different system and save it back as JSON. This will then run periodically.  The approval flow is a seperate flow that will use that JSON. 


Alternativley, is there a way to already filter on the first strucutre? i.e. input from power apps is Country "a" I can get email2 "b". 


I am really struggeling to wrap my head around this, since I am pretty new to Flow. Any ideas are much appreciated :). 




 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Transforming JSON

Hi @chrispy ,

 

For your requirement that convert the JASON array covert into your goal format couldn't be met in flow currently.

 

But you can filter on the first structure. There are screenshots you can have a reference:

 

  • Initialize variable to store the first Json Array.
  • When your input from PowerApps is Country is "a", determine it whether equal to "a"

-If yes, filter the Json Array, and get the array "Country" equal to "b".

1.PNG2.PNG

 

Please have a try, I hope it will help you.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Transforming JSON

Hi @chrispy ,

 

For your requirement that convert the JASON array covert into your goal format couldn't be met in flow currently.

 

But you can filter on the first structure. There are screenshots you can have a reference:

 

  • Initialize variable to store the first Json Array.
  • When your input from PowerApps is Country is "a", determine it whether equal to "a"

-If yes, filter the Json Array, and get the array "Country" equal to "b".

1.PNG2.PNG

 

Please have a try, I hope it will help you.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Regular Visitor

Re: Transforming JSON

Hi Mabel,

 

thank you for sharing the valueable post. Your solution worked great :). 

Instead of equals to however, I had to use contains, as it seems that the equal to operator only works with integer values. 

After filtering it, it was an array, so by using :

replace()

I replace '[' and ']' with blank so that I could filter the output body by i.e. : 

json(outputs('replacebracket'))?['Email']


Then I received an email string value that I can input into the approval flow.

Thank you for you help!

Best regards,
Christian

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new 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!

Users online (6,932)