Saturday, 22 April 2017

How to get specific value from JSON

I have JSON, which looks like this:

{ '-KiJz4D0pGYE35HPP-E4': { code: '211', lastname: 'Smith', firstname: 'John' } }

I do know that it will always look this way, ONLY one child in any case. How could I get value '211' stored under code key. Right now I have ugly code with foreach, it even works, but... Why would I use foreach at all if I know there is only one child?

Thanks a lot!



via vad7mir

No comments:

Post a Comment