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 / HTTP Request Compose H...
Power Automate
Unanswered

HTTP Request Compose Headers and Results in a Bracket Separated How to Parse JSON

(0) ShareShare
ReportReport
Posted on by 6
I have a compose statement after a HTTP call where the data comes out like this:
 
 
{
"count": 384,
"links": {
"next": null,
"previous": null
},
"headers": [
"MeasureID",
"MeasureVersionID",
"MeasureName",
"OfferingID",
"BaseCase1st",
"BaseCase2nd",
"MeasDescription"[,
 
 
"results": [
[
"SWHC020",
"SWHC020-01",
"Air Cooled Chiller",
"A",
"Air cooled constant speed screw chiller (>= 150 tons, 10.1 EER, 14 IPLV), CZ01",
null,
"Air cooled constant speed screw chiller (>= 150 tons, 11.1 EER, 15.4 IPLV), CZ01, NC"], 
 
[
"SWHC020",
"SWHC020-01",
"Air Cooled Chiller",
"A",
"Air cooled constant speed screw chiller (>= 150 tons, 10.1 EER, 14 IPLV), CZ02",
null,
"Air cooled constant speed screw chiller (>= 150 tons, 11.1 EER, 15.4 IPLV), CZ02, NC"
"Air cooled constant speed screw chiller (>= 150 tons, 10.1 EER, 14 IPLV)"
 
]
]
}
Categories:
I have the same question (0)
  • rosepetal140 Profile Picture
    6 on at
    Start of Flow:
     
    I am wondering how can I parse the JSON so that I can add a row into an excel table?
     
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    If I got this right, you want to restructure the JSON from something like this
    {
    	"headers":["header0", "header1", "header2"],
    	"results":[
    		[ "result00", "result01", "result02"],
    		["result10", "result11", "result12"]
    	]
    }
     
     ... to something like this
    [
      {"header0": "result00", "header1": "result01", "header2": "result02"},
      {"header0": "result10", "header1": "result11", "header2": "result12"}
    ]
     
    The following works for up to 7 headers, but you can of course add more if statements to the Map:
     
    From:
    outputs('Compose')['results']
     
    Map:
    json(
    	concat(
    		'{',
    		if(
    			greater(length(outputs('Compose')['headers']), 0),
    			concat('"', outputs('Compose')['headers'][0], '":"', item()[0], '"'),
    			''
    		),
    		if(
    			greater(length(outputs('Compose')['headers']), 1),
    			concat(',"', outputs('Compose')['headers'][1], '":"', item()[1], '"'),
    			''
    		),
    		if(
    			greater(length(outputs('Compose')['headers']), 2),
    			concat(',"', outputs('Compose')['headers'][2], '":"', item()[2], '"'),
    			''
    		),
    		if(
    			greater(length(outputs('Compose')['headers']), 3),
    			concat(',"', outputs('Compose')['headers'][3], '":"', item()[3], '"'),
    			''
    		),
    		if(
    			greater(length(outputs('Compose')['headers']), 4),
    			concat(',"', outputs('Compose')['headers'][4], '":"', item()[4], '"'),
    			''
    		),
    		if(
    			greater(length(outputs('Compose')['headers']), 5),
    			concat(',"', outputs('Compose')['headers'][5], '":"', item()[5], '"'),
    			''
    		),
    		if(
    			greater(length(outputs('Compose')['headers']), 6),
    			concat(',"', outputs('Compose')['headers'][6], '":"', item()[6], '"'),
    			''
    		),
    		'}'
    	)
    )
     
  • rosepetal140 Profile Picture
    6 on at
     
    Yes! I believe you are totally on the right track and thank you so much!  I did run into an error and also had a question:
     
    When I pasted the below into the Map I got the following error:
     
    I could have done something totally wrong.  But yes Ideally I want the output to look like this:
    [
    {
    "header0": "result00",
    "header1": "result01",
    "header2": "result02"
    },
    {
    "header0": "result10",
    "header1": "result11",
    "header2": "result12"
    }
    ]
     
    Once I retrieve the correct select - how do I parse the JSON to essentially then do the below where i add a row into a table?
     
    Thank you so much again for helping on this!
     
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    You must enter the Map code as an expression
     

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
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard