1

I need to access properties from this object, but I am getting undefined.

I tried use JSON stringify and parse but without success.

console.log('ress', response.data);
console.log('ress data', response.data.url);
console.log('ress key', response.data.key);

output:

ress {"url":"my url","key":"my key"}
ress data undefined
ress key undefined
jarmod
  • 71,565
  • 16
  • 115
  • 122
Paulo Rodrigues
  • 397
  • 4
  • 20

1 Answers1

2

Probably your response.data object is a string, in this case you have to parse it into a JSON object to be enable to access the properties.

object = JSON.parse(response.data);
console.log('data url', object.url);
Patrick Freitas
  • 681
  • 1
  • 5
  • 18