PDA

View Full Version : Read a multilevel data with Json Reader



ask45ru
18 Jun 2012, 12:33 AM
Hi all!

I have a store with a proxy using Json Reader.

Json response looks like:


{"success":true,"items":"{\"count\":2,\"departments\":[{\"id\":1,\"name\":\"\u041c\u043e\u0441\u043a\u0432\u0430\",\"group\":\"group\"},{\"id\":2,\"name\":\"\u0418\u0440\u043a\u0443\u0442\u0441\u043a\",\"group\":\"group\"}]}"}

I need to load a data to the store from "departments" element.

I tried to set reader options:

root: 'items.departments
and

root: 'departments
but it doesn't work.

How can I get access to departments-element?

scottmartin
18 Jun 2012, 4:38 PM
Are you encoding the object to cause all of those escaped quotes?

Scott.

ask45ru
18 Jun 2012, 10:00 PM
Yes, it's encoded by json_encode PHP-function

scottmartin
19 Jun 2012, 5:56 AM
Try placing the json in a file and removing the escaped quotes and use the file as the URL to test.

Scott.

ask45ru
19 Jun 2012, 7:48 PM
Thanks for an advice, I didn't pay attention on it) Now it works fine)