-1
{
  "Listings": {
            "\/#BestSellers": {
                "Title": "Best Sellers"
             }
}

How to access BestSellers key and get its value

Sarath Dixit
  • 81
  • 1
  • 12
  • Once parsed, use the square bracket notation. `data.Listings["\/#BestSellers"]` --- Edit: the JSON has a syntax error. – evolutionxbox Jul 30 '21 at 16:38
  • 1
    Technical, but important, note on terminology: there is no such thing as a "JSON object". There is JSON, which is an inert, meaningless string, and there is the result from decoding the JSON string into real Javascript data, at which point you're working with normal Javascript data, not JSON. – Mike 'Pomax' Kamermans Jul 30 '21 at 16:38
  • 1
    Arguably the string is not 'meaningless' but it *is* just a string. – pilchard Jul 30 '21 at 16:39
  • As just a string, it's as meaningless as any other string, until you pair it with a parser/interpreter. – Mike 'Pomax' Kamermans Jul 30 '21 at 16:39

1 Answers1

0

you can use [] square notation to access dynamic keys. for your current usecase store the json in object and access like so

obj["Listings"]["/#BestSellers"]