Search code examples
javascriptarraysjsonobjectidentifier

Retrieving data from a JSON sub array in javascript, where identifier starts with an integer


I must be missing something simple here, but I'm having trouble retrieving data from a JSON array response. I can access objects with identifiers that start with letters, but not ones that start with numbers.

For example, I can access

data.item[0].specs.overview.details

But I can't access

data.item[0].specs.9a99.details

Solution

  • Use bracket notation

    that is:

    data.item[0].specs["9a99"].details