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

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

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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Users online (7,299)