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 / Rearrange JSON output ...
Power Automate
Answered

Rearrange JSON output from HTTP Request

(0) ShareShare
ReportReport
Posted on by 682
Is there a way to re-arrange the output from the screenshot below, coming from an HTTP request, to something like this?
 
{"issueID": "list the id associated with an issue",
"assetID": "list the corresponding id associated with the asset"},
{"issueID": "list the next id associated with an issue",
"assetID": "list the next corresponding id associated with the asset"}
 
Could this be done with a compose statement?  I essentially need the id values from issue/asset pairs. The API returns the pairs, but an asset may be listed before OR after the corresponding issue.
I want each asset/issue pair grouped in a consistent manner, as shown above.
 
I am also able to get an array like this but would need a way to group every two rows together.  (Rows 1 and 2 are a pair, Rows 3 and 4 are a pair).  There could be many more than 4 rows, but would always be an even number, with adjacent items being pairs.
 
 
Thanks.

 

 
Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,713 Super User 2026 Season 1 on at
    Just one Select:
     
     
    From: @{outputs('Compose')}
     
    Map issueId:
    xpath(
    	xml(json(concat('{"Root": {"Item": ', item(), '}}'))),
    	'string(//Item/entities[type="issue"]/id)'
    )
    Map assetId:
    xpath(
    	xml(json(concat('{"Root": {"Item": ', item(), '}}'))),
    	'string(//Item/entities[type="asset"]/id)'
    )
     
  • Chriddle Profile Picture
    8,713 Super User 2026 Season 1 on at
    If xapth looks too scary, you can also use this:
     
    Map issueId:
    if(
    	equals(
    		first(item()['entities'])['type'],
    		'issue'
    	),
    	first(item()['entities'])['id'],
    	last(item()['entities'])['id']
    )
    Map assetId:
    if(
    	equals(
    		first(item()['entities'])['type'],
    		'issue'
    	),
    	last(item()['entities'])['id'],
    	first(item()['entities'])['id']
    )
     
  • 55552 Profile Picture
    682 on at
    I think your solution may work, but how should I dynamically get the asset and issue Ids?
     
    {
          "entities":[
              {"type": "asset",
             "id": 'id'  //need to dynamically get the id associated with this (it is a guid)
      },
  • Verified answer
    Chriddle Profile Picture
    8,713 Super User 2026 Season 1 on at
    Simply put your array “relationships” into a Compose and use the Select below to retrieve them.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 223

#2
David_MA Profile Picture

David_MA 210 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 175

Last 30 days Overall leaderboard