PDA

View Full Version : Ext.util.JSON.decode problem



spawn150
6 Jul 2007, 8:26 AM
Hi all,

I've a problem with Ext.util.JSON.decode() function. Why, with the following code, does it work:


var decoded = eval('({"rows": [{"id": "id","billCycleCode":"BillCycle"},{"id":"id2","billCycleCode":"Bill Cycle"}]})');

Instead with this code it doesn't work:



var decoded = Ext.util.JSON.decode({"rows": [{"id": "id","billCycleCode":"Bill Cycle"},{"id": "id2","billCycleCode":"Bill Cycle"}]});


Help me please, beacuse I really don't know where is the problem! :((

Thanks,

Francesco

tryanDLS
6 Jul 2007, 8:32 AM
From the doc (http://extjs.com/deploy/ext-1.1-beta2/docs/output/Ext.util.JSON.html#decode), decode takes a string as an arg, not an object.

spawn150
6 Jul 2007, 10:22 AM
thank you very much, I didn't see that was a object! 8-|