Monday, January 03, 2011

Native JSON

var jsonObjStr = '{"name":"Erast Fandorin", "speciality":"detective"}';
var object_person = JSON.parse(jsonString);
// object_person is object now with 2 properties

var personString = JSON.stringify(person);
// personString now keeps the string '{"name":"Erast Fandorin", "speciality":"detective"}'

this native JSON is now supported mostof browsers, so just use it :)

No comments :