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 Smiley Happy




 

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.
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.
chrispy
Level: Powered On

Re: Transforming JSON

Hi Mabel,

 

thank you for sharing the valueable post. Your solution worked great Smiley Happy

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

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!

Users Online
Currently online: 147 members 3,710 guests
Please welcome our newest community members: