I’ve done this many other times, but this json response looks a bit different which is perhaps what’s throwing me off, not sure.
I’m trying to simply map through the response to grab particular fields. I wrote the json response to a variable and then dropped it into json path finder (great tool!) to find the path. What is different about this path is that the numbered list doesn’t appear as the high level name. I had thought that mapping through wouldn’t be an issue – but there’s something I’m missing. What I’m trying to return is located at:
x.AMZN.symbol
x.IBM.symbol
When I used the map function to return values, I get an expression error. Any thoughts?
The code I’m using is below as is the json returned:
response = $context.response.data
myString = map(response,
concat(x.symbol, "\r\n"
)
)
join(myString, "\r\n")
JSON response:
{
"AMZN": {
"symbol": "AMZN",
"name": "Amazon.com Inc",
"exchange": "NASDAQ",
"mic_code": "XNGS",
"currency": "USD",
"datetime": "2023-05-10",
"timestamp": 1683742124,
"open": "108.15000",
"high": "110.20000",
"low": "108.05000",
"close": "109.53000",
"volume": "52219578",
"previous_close": "106.62000",
"change": "2.91000",
"percent_change": "2.72932",
"average_volume": "74170408",
"is_market_open": true,
"fifty_two_week": {
"low": "81.43000",
"high": "146.57001",
"low_change": "28.10000",
"high_change": "-37.04001",
"low_change_percent": "34.50816",
"high_change_percent": "-25.27121",
"range": "81.430000 - 146.570007"
}
},
"IBM": {
"symbol": "IBM",
"name": "International Business Machines Corp",
"exchange": "NYSE",
"mic_code": "XNYS",
"currency": "USD",
"datetime": "2023-05-10",
"timestamp": 1683742089,
"open": "121.89000",
"high": "122.43500",
"low": "121.10000",
"close": "121.53000",
"volume": "1915690",
"previous_close": "121.17000",
"change": "0.36000",
"percent_change": "0.29710",
"average_volume": "3954609",
"is_market_open": true,
"fifty_two_week": {
"low": "115.54500",
"high": "153.21001",
"low_change": "5.98500",
"high_change": "-31.68001",
"low_change_percent": "5.17980",
"high_change_percent": "-20.67751",
"range": "115.544998 - 153.210007"
}
}
}