0
I have the following json:
{
"destination_addresses": [
"Rua B, 1 - Coqueiro,Belém - PA, 66670-350, Belém - PA, 66670-350, Brasil"
],
"origin_addresses": [
"Pref. José Walter, Fortaleza - CE, 60810-670, Brasil"
],
"rows": [
{
"elements": [
{
"distance": {
"text": "1.495 km",
"value": 1495361
},
"duration": {
"text": "20 horas 33 minutos",
"value": 74009
},
"status": "OK"
}
]
}
],
"status": "OK"
}
my difficulty is basic I know, but I’m not getting access to the json nodes, when I try
data.destination_addresses returns me exactly
["Rua B, 1 - Coqueiro,Belém - PA, 66670-350, Belém - PA, 66670-350, Brasil"]
and not just the value.. Rua B, 1 - Coqueiro,Belém - PA, 66670-350, Belém - PA, 66670-350, Brasil
and also can not access for example the distance or duration I tried already data.rows.elements.distance and data.rows[0].elements.distance but neither can I.. what is missing so that I can access the nodes?
Obs. utilizo vuejs.
data.destination_addressesgives you an array, that’s useful if you want to divide by lines. Is that the case? And what isdata.rows.elements? What HTML do you want to insert data into?– Sergio
Hello @Sergio
data.rows.elementsI am trying to print this node on the page type `{{data.rows.Elements}} but it is Undefined– Lennon S. Bueno
But you must have one
v-forsomewhere right? Make your Vue component clearer.– Sergio
@Sergio, look what I’m trying to do here https://jsfiddle.net/26utr8wd/
– Lennon S. Bueno
I haven’t had time to see it yet. Tomorrow I’ll take a look if you haven’t solved the problem.
– Sergio
@Sergio would like it, yeah
– Lennon S. Bueno