Here is the problem: I use mootools.
JSON.stringify internally calles Array.toJSON(), and this is overridden by the mootools framework as :
Array.prototype.toJSON
function(){return JSON.encode(this);}
The solution is to define stringify the mootools way and not use JSON.stringify():
function stringify(obj, replacer, spaces, cycleReplacer) {
return JSON.encode(obj)
}
Or the ExtJS way:
function stringify(obj, replacer, spaces, cycleReplacer) {
return Ext.encode(obj)
}
@zeeg, thanks for your help.