lkallas
lkallas

Reputation: 1406

Getting value from an object with jQuery

I have this JSON, that I need to use.

{"services":{"344":{"post":{"ID":344}},"345":{"post":{"ID":345}}}}

I need to get the value of services.344.post.ID which is 344. How can this be achieved?

Thank you in advance.

Upvotes: 0

Views: 18

Answers (1)

rafaelc
rafaelc

Reputation: 59284

If

var obj = JSON.parse('{"services":{"344":{"post":{"ID":344}},"345":{"post":{"ID":345}}}}');

Then you want obj['services']['344']['post']['ID']

Upvotes: 1

Related Questions