user1415459
user1415459

Reputation: 159

How to read nested json file with several roots in extjs

How to read the following json file and display in extjs grid columns?

{
    "users": [
        {
            "id": 123,
            "name": "Ed",
            "orders": [
                {
                    "id": 50,
                    "total": 100,
                }
            ]
        }
    ]
}

Could someone explain how to read the nested data in the json? I have tried a lot of options like renderer functions, using the '.' property, etc.

Edit: I would like to read the data within "orders", which are "id" and "total".

Upvotes: 1

Views: 2323

Answers (1)

Neil McGuigan
Neil McGuigan

Reputation: 48287

You are trying to read in an array nested in an object nested in an array.

So your root would have to be users[0].orders

Is that really what you are trying to do?

Working code:

http://jsfiddle.net/el_chief/s6Ynp/1/

Why is your code nested like this?

Upvotes: 1

Related Questions