I am using MS powerautomate, forms, excel and office scripts to get some data, do validations, make/edit tables. In my flow, I get the data from form response and put it into JSON format to use easily in a few places. In my script, I would like to use the values by their key so the code is a little clearer rather than repeating the variables everywhere or calling by number index ..
My JSON looks like this:
{
"response": [{
"responseID": "2",
"fullName": "Jay S",
"seniorityNumber": "M1",
"rStartDate": "2022-01-11",
"rEndDate": "2022-01-14", ...etc
}]
}
In my script, I see an object that looks like this with console.log
response:Array(1)
0: Object
responseID:2
fullName:Jay S... etc
I want to use/reference the values by the key in my script like:
responseIDValue = response["responseID"] / response[0]["responseID"]
Tried searching, saw some stuff using JSON.parse() but can't get it to work.. How can I get the value by key?
Thanks!