1

I am hitting a test API I built with jQuery which gives me a JSON.

In my Javascript, I am doing the following:

var myjson = (getData['responseJSON']['results']);
console.log(myjson);

This yields the below results:

{"A":{"0":1,"1":2},"B":{"0":2,"1":3},"C":{"0":3,"1":4}}

I would like to instead just return the values for A, which I assumed would just be like below. But when I do this I get undefined. What am I doing wrong here?

var myjson = (getData['responseJSON']['results']['A']);
console.log(myjson);

1 Answer 1

2

var myjson = JSON.parse(getData['responseJSON']['results']); console.log(myjson['A']);

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

Comments

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.