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

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
Community Support Team
Community Support Team

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
Community Support Team
Community Support Team

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

chrispy
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,445)