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

Notifications

Announcements

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)
  • 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.
     
  • Suggested answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    In your Filter array, do this

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 258 Super User 2025 Season 2

#2
trice602 Profile Picture

trice602 205 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 204 Most Valuable Professional

Last 30 days Overall leaderboard