Ext JS - Learning Center

Manual:Utilities:json Decode

From Learn About the Ext JavaScript Library

Jump to: navigation, search

Ext.util.JSON.decode Utility

Ext.util.JSON.decode (shorthand Ext.decode) can be utilized to convert a JSON string into a Javascript object with ease.

Usage is simple:

var stringData = "{date: 'Friday 03rd of August 2007 02:47:09 PM'}";
try {
	var jsonData = Ext.util.JSON.decode(stringData);
	Ext.MessageBox.alert('Success', 'Decode of stringData OK<br />jsonData.date = ' + jsonData.date);
	// You can do anything with jsonData if you want.
}
catch (err) {
	Ext.MessageBox.alert('ERROR', 'Could not decode ' + stringData);
}

See Also

Working with JSON

  • This page was last modified 03:42, 25 September 2007.
  • This page has been accessed 5,772 times.