1
{
    "2": [{
        "name": "Jeevan",
        "age": "7"
    },
    {
        "name": "Jeet",
        "age": "8"
    }],
    "school": "Kendriya Vidyalaya"
}

I am having this JSON stored in variable named Obj. I would like to access individual JSON Objects inside of JSON Array which has a a key as "2". Please help me to access the same.

As far as conventional way is considered i.e Obj.key, it is not applicable here because Obj.2 or Obj."2" is not allowed.

1
  • 4
    Which technology are you using? Commented Aug 24, 2017 at 11:55

2 Answers 2

1

I believe you are working with javascript.

Try to access the date like this:

array = Obj["2"]
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks For Your Help!!
0

This should work

var o = { "2": [{ "name": "Jeevan", "age": "7" }, { "name": "Jeet", "age": "8" } ], "school": "Kendriya Vidyalaya" };
o["2"];
o["school"]

1 Comment

I am grateful to you !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.