View Full Version : Is there a way to parse more complicated JSON in JsonReader?

10 Aug 2007, 8:55 AM
Hi Everybody,
Is there a way to parse more complicated JSON in JsonReader?
Or may be there is another way to do it.
I have dynamic data which is looking like this:

{"attrs":{"a_307":{"value":"human","name":"Mammal"},"a_67":{"value":1,"name":"IO Number"},"a_62":{"value":78,"name":"Folder"},"a_183":{"value":"because","name":"Why"},
"a_109":{"value":304,"name":"Some validation"},"a_232":{"value":326,"name":"flargleblast"}, a_282":{"value":589,"name":"Boring"}, "a_68":{"value":54656489,"name":"Cell id"}}, parent_info":{"a_307":{"required":0,"mutable":1}, "a_67":{"required":0,"mutable":1}, "a_62":{"required":0,"mutable":1},"a_183":{"required":0,"mutable":1}, "a_109":{"required":0,"mutable":1}, "a_232":{"required":0,"mutable":1}, "a_282":{"required":0,"mutable":1},"a_68":{"required":0,"mutable":1}}

Thank you.

10 Aug 2007, 8:59 AM
[ moved to Help from Prerelease ]

10 Aug 2007, 10:30 AM
JsonReader does not support this kind of format. If you can't modify format, you should write your own reader (extend JsonReader and override readRecord).

12 Aug 2007, 2:40 PM
Thank you for the help.
Could you please point me to some code sample for this technique?


12 Aug 2007, 11:40 PM
JsonReader can use dot notation to extract nested data from the row object.

13 Aug 2007, 7:08 AM
Sorry, I am very new to EXT. I did not understand how it will look for the sample data I posted?
How will I reference the JSON element without name (which is valid JSON)?

13 Aug 2007, 1:55 PM
Is it possible to load this JSON and read it like this,
with ArrayReader

reader: new Ext.data.ArrayReader
root: "attr",
{name: 'name'},
{name: 'type'},
{name: 'value'}