JesúsDel
JesúsDel

Reputation: 103

Access to the data of a call in axios javascript

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

Answers (1)

user6749601
user6749601

Reputation:

Try

const name = response.data["Province:name"];
console.log(name);

Upvotes: 1

Related Questions