2

To access specific JSON data i need to access Main -> Listing -> c44 -> Mydata

c44 is dynamic and can be anything. I have it in my variable - var cc

To access needed data, i write: var result = Main.listing. * how can i specify cc var here? *

Tried console.log (main.listing.["cc"]); but never worked

2
  • 2
    you want main.listing[cc] Commented Aug 21, 2018 at 0:07
  • @JaromandaX Worked! Thanks so much! Commented Aug 21, 2018 at 0:09

2 Answers 2

4

Since cc is a variable, you should remove the quotes ". Try:

console.log (main.listing[cc]);

Sign up to request clarification or add additional context in comments.

Comments

0

You can access the data using

Main.Listing[cc]

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.