Reputation: 103
I am trying to access a json that returns a call to the api through axios, but the problem is that it returns it like this, how can I access Province:name
I tried response.data.province:name but it shows an error
{ "Province:name": [
{
"id": 1,
"name": "Álava",
"provinceCode": "1",
},
{
"id": 2,
"name": "Albacete",
"provinceCode": "2",
}
]}
Upvotes: 0
Views: 26
Reputation:
Try
const name = response.data["Province:name"];
console.log(name);
Upvotes: 1