Home Access / process (nested) objects, arrays or JSON
Reply: 0

Access / process (nested) objects, arrays or JSON

user435
1#
user435 Published in July 17, 2018, 7:48 am

I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)?

For example:

var data = {
    code: 42,
    items: [{
        id: 1,
        name: 'foo'
    }, {
        id: 2,
        name: 'bar'
    }]
};

How could I access the name of the second item in items?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.517927 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO