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 / Accessing values in js...
Power Automate
Answered

Accessing values in json object using index

(0) ShareShare
ReportReport
Posted on by 932

I wish to access the answers in a response object by using their index.

I saw a response by @Pstork1 where he mentioned doing exactly that. I was hoping someone could describe how that is accomplished.

For reference, here is the object in question:

{
  "responder""BDonahue@healthcareswfl.org",
  "submitDate""10/2/2020 6:02:14 PM",
  "raf03b7b3e8054666b737a20e30d25abf""",
  "r71b19e7c5beb4dba95fee5e9d9578bc2""No",
  "r4da533c8aeb3472aacd19c2f1250e75c""",
  "r53d3e3791038471f894029c5634d8e6d""No",
  "r2efc3356f5064729b0f186e7f6b5b52d""No",
  "rb7dbfe7ca0cc4b25a1cf659414fff419""No",
  "r014fe8a6004b46dbb1dbed880968ca79""No",
  "r20d0ef76e51e426f8911d0d7ce2e272e""",
  "rb906a66fb83c449ca1d0e35c427f3a02""13",
  "r24be9a1ba7f9468fae16b296331d4c25""",
  "r0184384dd0c44d88af36051a758ba5aa""No",
  "r8b337663cc03426c92704ccd813be3b8""No",
  "rdf04e95ac19042a5894ca0f7b35292d0""",
  "r23ebfc6e6b8d4729923867b8e6ebd548""No",
  "r7486d8f749194143a405d901c0099799""",
  "r48c1c4e8093743ed92d8e9fb9a9a2978""s1 notes",
  "r92b84414bcdd47e1a81bd7e3fa4245e4""s2 notes",
  "r745fad073e1745d0a0d5edf25e7d2fb0""s3 notes"
}

Thank you for your help.

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,925 Most Valuable Professional on at

    Unfortunately, that's not an array, so there is no way to access those properties by a numeric index.  But you can load it into a Parse Json action and access the properties directly by name.

    image.png

  • BenDonahue Profile Picture
    932 on at

    Thank you, @Pstork1 , for your quick reply. Perhaps I should describe what I am hoping to do in better detail.

    With 40-90  questions to deal with, I am hoping to have a list of those questions that exactly matches the content and order of the questions on the Forms Pro form (which I am re-creating so the JSON will have the responses in order, too).

    Having established that, I am further hoping to populate emails with the questions and responses dynamically. My strat on this is to have two arrays, one that is populated from an Excel table, and one that is populated from the "Get response details" outputs.

    Then, utilizing an incrementing variable, use that variable to access the index of each array to populate the email body.

    arrQuestions[(variables('intIndex'))]: arrAnswers[(variables('intIndex'))]   (or something to that effect)

    Assuming any of this makes sense, would you mind helping me accomplish this? I believe all I need is to get the responses into an array, which escapes me.

    Thank you, again; your help is greatly appreciated.

  • Verified answer
    Pstork1 Profile Picture
    68,925 Most Valuable Professional on at

    I don't know of any way to get the properties of an object(JSON) converted into an array.  But the properties should be in the same order each time for a particular survey form and the keys will always match to each question.  I would suggest running the survey once to find out what the keys for each question are and then creating an Excel table with the questions and the corresponding key.  Then you should be able to access the answers from the JSON using the keys.

     

    The only time looping would be involved would be to process multiple responses from different people.  Then you would have an array of objects like the one you listed in your first question.

  • BenDonahue Profile Picture
    932 on at

    Would I be able iterate over the JSON and somehow access the answer at each iteration and append that to an array variable?

  • Pstork1 Profile Picture
    68,925 Most Valuable Professional on at

    I'm not aware of any way to do that with the different properties in the object.  Each property is addressed by name.

  • BenDonahue Profile Picture
    932 on at

    @Pstork1 ,

    It took a night's sleep, but I finally woke up to the realization of what you are saying; having an array of the question codes is as good as having an array of the answers, in this case. 

    Thank you for your help and patience with me.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 58

#2
David_MA Profile Picture

David_MA 53 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 36 Most Valuable Professional

Last 30 days Overall leaderboard