Share feedback, ideas and get community help

Updated 5 months ago

HTTP Request to Array to Button

At a glance

The community member is trying to save an array of cities returned from an API request, but is having trouble accessing the data correctly. The issue is that the data is stored in a dynamic property (the zipcode), so the community member should use data["75001"].cities instead of data.75001.cities. Another community member confirms that this solution works, and the original poster mentions that they ended up using data["{{zipcode}}"].cities to handle the dynamic zipcode.

Hi!
I am trying to wrap my head around why an array from a http request is not saved.
I want the user to input his zipcode, then a request is ran against my API which returns an array of possible cities. Those are then presented to the user to select one (dynamic data).

Sample Return from the API:
{
"statusCode": 200,
"data": {
"75001": {
"zipcode": "75001",
"cities": [
"PARIS-01",
"PARIS-1ER-ARRONDISSEMENT"
]
}
}
}

Save in Variables:
data.75001.cities
as "cities"

Result: Nothing saves in "cities"

Thanks for your help!
B
l
3 comments
Thanks it is indeed an issue. You should type: data["75001"].cities instead
@Baptiste Thank you. I confirm that it is working with your suggestions
for future reference, in the end i used data["{{zipcode}}"].cities to reflect the dynamic part of the API response
Add a reply
Sign up and join the conversation on Discord