Help with json!

(Been 0) #1

Hi There !
I’m trying to get keys from my json api request …
I usually use get data and the key name bet I’m stuck here with this situation .
example of the json
{
“country”: “ru”,
“list”: {
“15”: {
“id”: “15”,
“name”: “sar”
}
“16”: {
“id”: “14”,
“name”: “hero”
}
}
}
if I wanted to get country I simply do
{{make_a_http_request.data__country}}
and in case of id
{{make_a_http_request.data__list__15__id}}

the problem is that it’s not 15 for const
my users give me their numbers
and I should get id and name like
{{make_a_http_request.data__list__“theirNumber”__id}}

I tried to make it an attribute like
{{make_a_http_request.data__list__{{attribute}}__id}}

it did not work …
any suggestions ?

#2

You can use Code block like this

var list = {{make_a_http_request.data__list}};
var result=list[{{attribute}}];
resolve(result);
1 Like
(Been 4) #3

that was very helpful , thanks !