PDA

View Full Version : Consuming JSON



dreamcaster
28 Sep 2009, 5:42 PM
Hello experts,

I'm having trouble consuming this kind of JSON format in a data store:


{
"root": [
{
"name": "John",
"attendance": [
{
"year": "2009",
"month": "09",
"day": "01",
},{
"year": "2009",
"month": "10",
"day": "01",
}
]
}
]
}

In that JSON, how can I consume the attendance array? My store:


myStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'attendance.json'
,method: 'GET'
})
,reader: new Ext.data.JsonReader({
root: 'root.attendance'
},[
{name: 'year', mapping: 'year'}
,{name: 'month', mapping: 'month'}
,{name: 'day', mapping: 'day'}
])
});

Did I miss something? Thank you guys.

dreamcaster
28 Sep 2009, 6:49 PM
Got the fix, I changed the root to
root[0].attendance