web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert multiple json ...
Power Automate
Answered

Convert multiple json objects into json array by key value

(0) ShareShare
ReportReport
Posted on by 295
Hello,
I am receiving a json file that has multiple objects.  Each object has a sales-order number, there can be multiple objects with the same sales-order, I want to produce one json file per sales-order.
I have been able to produce the unique sales-order numbers, and now I am trying to filter the incoming json by the sales-order.
The next step would be creating an array within the new json file - one step at a time.
 
I am using compose to get the sales-order and made it so I get one of each value:
This uses the expression: union(body('Select_KeyValuePair'),body('Select_KeyValuePair'))
 
When I filter on the output of Compose MakeUnique I get no output.
I have tried various options in the value field, but even the sales-order vale 393195 still returns no output. 
From: body('ParseNPIJSON')
Filter Query: item()['Sales-Order']
 
 
The original json is in the following format:
 
 
I would like to turn it into this format:
 
 
This is my flow so far
 
Thanks
Rosie
Categories:
I have the same question (0)
  • Suggested answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    In your Filter array, do this
  • Verified answer
    Rosie Profile Picture
    295 on at
    Hello @SudeepGhatakNZ,
    Thanks for your suggestion.
    I did get an error with that suggestion.
     
    "The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@equals(item(items('For_each_3')['Key']),item()['Sales-Order'])' failed: 'The template language function 'item' must not have any parameters.'."
     
    I added in a compose to the foreach to convert the key value to an int value, then used that in the 
     
    Which resulted in this output.
     
     
    Then used the output of the Compose GetKeyValue
     
     
    That seemed to work.
    Strangely the Filter Array Output shows "No Outputs", but if I click on "Show raw outputs" I get the filtered json.
     
    My next stage is working out how to collect the Shipping marks, product, # packs to generate an array within a single json object for the sales-order.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 86 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 55

#3
Ellis Karim Profile Picture

Ellis Karim 53 Super User 2026 Season 1

Last 30 days Overall leaderboard