PDA

View Full Version : [CLOSED] Ext.util.JSON.decode() fails



elishnevsky
27 Jul 2010, 12:34 PM
Using v0.92, but the bug existed in 0.91 as well. Parsing JSON results in an error.


Uncaught SyntaxError: Unexpected token ILLEGAL. ext-touch-debug.js:5495

Tested the following data:

var data = {
items: [
{firstName: 'Julio', lastName: 'Benesh'},
{firstName: 'Julio', lastName: 'Minich'},
{firstName: 'Tania', lastName: 'Ricco'},
{firstName: 'Odessa', lastName: 'Steuck'}
]
};

or


var data = [
{firstName: 'Julio', lastName: 'Benesh'},
{firstName: 'Julio', lastName: 'Minich'},
{firstName: 'Tania', lastName: 'Ricco'},
{firstName: 'Odessa', lastName: 'Steuck'}
];

Thanks.

Jamie Avins
27 Jul 2010, 1:02 PM
So after some attempts of trying to get this to work in the Safari Debugger we found out that valid JSON according to the native JSON implementation uses double quotes inside the JSON data rather then single ones.
If you change your data to something like: {"success": true, "message": "hello"} it seems to be able to parse it.

Let us know if it helps.

elishnevsky
27 Jul 2010, 1:16 PM
Thanks, it indeed helped. Are you guys planning to keep it as is?

Jamie Avins
27 Jul 2010, 2:16 PM
Yes as its is how the mobile webkits want to handle it.