I need some help, so I need to access the field in json, I got the json from an API, I know how to access a json but there's one problem, I can't access the field with apostrophe
here's the json I received:
datas: {
stats: {
attack: 60
defense: 70
'special-defense': 50
speed: 90
}
}
I want to access the special-defense, I have tried datas.stats.special-defense
but isn't working,
I tried datas.stats.'special-defense'
too and it's giving invalid syntax.
I can access another field like speed
,attack
, and defense
with datas.stats.speed
etc.
is there any way to access that field?