PDA

View Full Version : Ext.JSON.encode() Indentation



okwei
19 Feb 2013, 7:16 AM
Is there a way to have indentation for Ext.JSON.encode()? The browser JSON.stringify() provide an extra parameter to add indentation, but it is not available to older browsers (e.g. IE7/8)

Thanks

scottmartin
19 Feb 2013, 11:14 AM
You would have to override the encode function to include your own code.



me.encode = function(o) {
if (!encodingFunction) {
// setup encoding function on first access
encodingFunction = isNative() ? JSON.stringify : me.encodeValue;
}
return encodingFunction(o);
};


I do not believe this would be added to the API as it would be considered bloat.

Scott.