Skip to main content

Notifications

Power Automate - General Discussion
Answered

Parsing json - get first item of an array

(2) ShareShare
ReportReport
Posted on by 25
From an HTTP get call I'm getting this json back:
 
[{"Value": "BRUUL","Id": 39318,"Brussels": false}]
 
I simply want to take the value for the Id property of the first item in the array.
 
I've been reading up on articles I found via several search engines, trying with compose and set variable but either it goes into a apply each block, which I don't want, or I keep on getting the entire above string sent back to my Power Virtual Agent.
  • Chriddle Profile Picture
    Chriddle 7,371 on at
  • _Judy_ Profile Picture
    _Judy_ 91 on at
    Re: Parsing json - get first item of an array

    Thank youuuuuu. You are my hero. 😀

  • DeepakS Profile Picture
    DeepakS 2,301 on at
    Re: Parsing json - get first item of an array

    Hi @KrisvanderMast 

     

    Checkout following link:

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

     

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • KrisvanderMast Profile Picture
    KrisvanderMast 25 on at
    Re: Parsing json - get first item of an array

    Did a rename of my action and it worked. 

     

    Is there some overview/list of functions like body() and the likes I can take a look at and learn?

  • DeepakS Profile Picture
    DeepakS 2,301 on at
    Re: Parsing json - get first item of an array

    Hi @KrisvanderMast 

     

    Parse_JSON_2 is the action name in my FLOW, in your flow you should use action name that in your flow. share a screen capture of your flow i will let you know what to use.

     

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

     

  • KrisvanderMast Profile Picture
    KrisvanderMast 25 on at
    Re: Parsing json - get first item of an array

    Hi,

     

    that gives me the following error:

     

    Correct to include a valid reference to 'Parse_JSON_2' for the input parameter(s) of action 'Initialize_variable'.

     

     

  • Verified answer
    DeepakS Profile Picture
    DeepakS 2,301 on at
    Re: Parsing json - get first item of an array

    Hi @KrisvanderMast 

     

    After you parse your JSON using parse JSON action use following expression :

    body('Parse_JSON_2')[0]['Id'] this will give you id of first item

     

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard