1

I want to reach the "official-artwork" key returned from the API, but I cannot reach the "official-artwork" key due to the - sign. How can I access keys of this type?

official-artwork: {value}
furkanbicak
  • 33
  • 1
  • 7
  • There are already multiple questions and answers on this topic, like [here](https://stackoverflow.com/questions/13869627/unable-to-access-json-property-with-dash) or [here](https://stackoverflow.com/questions/10148423/json-contains-minus-char-is-this-valid-standard). – ahuemmer May 21 '22 at 07:49

2 Answers2

1

try this:

item?.sprites.other['official-artwork']
Yasin Br
  • 1,675
  • 1
  • 6
  • 16
0

Put it in block & quotes:

item?.sprites.other["official-artwork"]
John Detlefs
  • 952
  • 8
  • 16