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

Community site session details

Session Id : IN/GXtXJlkL38pkqZb+dRr
Power Automate - Building Flows
Answered

Reading JSON Data from HTTP response

Like (0) ShareShare
ReportReport
Posted on 12 Feb 2025 13:44:36 by 173
Hi all,
 
I have  been struggling to get data out from this HTTP dynamic response. There's a lot of lines but I only picked the two first lines beacuse all are the same.

 "16126468098270": {
    "DT_RowId": "16126468098270",
    "amount": 25000,
    "cardId": "5bfdc96818fc7282bc46c41a",
    "comment": "",
    "date": "2019-03-04",
    "financier": "XXXXX",
    "name": "",
    "type": "QQQQ"
  },
  "16126468436010": {
    "DT_RowId": "16126468436010",
    "amount": 50000,
    "cardId": "5d57f079e9de12632cb297be",
    "comment": "",
    "date": "2019-11-11",
    "financier": "YYYY",
    "name": "",
    "type": "ZZZZZ"
  },

I just want to be able to get the values of the objects between the  "16126468098270", "16126468436010", etc. So I want the "amount", "cardId", etc.
I have tried with Select, but it only gives me "null" values, and there is no "null" values in the list.


  • LennartWalldĂ©n Profile Picture
    173 on 13 Feb 2025 at 08:08:27
    Reading JSON Data from HTTP response
    Thanks @Chriddle,
     
    This worked perfect! I must admit that I wasn't aware of the power of xpath. I am not sure I understand exactly how it works, but anyhow it solved my problem.
    I will try to dig deeper into it sometime.
  • Verified answer
    Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 12 Feb 2025 at 14:27:18
    Reading JSON Data from HTTP response
    Assuming that your HTTP response looks similar to the content in my Compose:
     
    The property names are repeated in each DT_RowId.
    Therefore, you can easily query them using xpath.
    Using a Select, you can convert this into a simple array.
     
     
    From:
    xpath(
    	xml(outputs('Compose')),
    	'//body/*/DT_RowId/text()'
    )
    Map:
    outputs('Compose')['body'][item()]
     
  • LennartWalldĂ©n Profile Picture
    173 on 12 Feb 2025 at 14:14:19
    Reading JSON Data from HTTP response
    Thanks @Infamous_Let

    I tried your suggestion, but i Got an error in Apply to each:
     'The template language function 'json' expects its parameter to be a string or an XML. The provided value is of type 'Object'
     
    Any suggestions?
  • Suggested answer
    Infamous_Let Profile Picture
    269 on 12 Feb 2025 at 13:51:32
    Reading JSON Data from HTTP response

    It looks like the issue comes from the dynamic keys in your JSON response. Since the outermost keys (16126468098270, 16126468436010, etc.) are always changing, a normal Select action won't work directly because it expects fixed properties.


    The best way to handle this in Power Automate is to first use Parse JSON on the HTTP response. Then, instead of referencing specific keys, loop through the JSON dynamically. You can do this with an Apply to each, setting the input to json(outputs('Parse_JSON')). Inside the loop, use expressions like item()?['amount'], item()?['cardId'], and so on to extract the values properly.


    If Select is returning null, it's likely because it's trying to find fixed property names that don’t exist. Converting the JSON object into an array before processing will help fix this. Try using an expression like json() to transform the data, and you should start seeing the actual values instead of null.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete