Extjs JSON编码解码
2018-09-12 本文已影响0人
w_w_wei
对象转字符串
var obj = {a:'a', b:'b', c:'c'}
Ext.encode(obj);
//"{"a":"a","b":"b","c":"c"}"
字符串转对象
var b = '{"a":"a","b":"b","c":"c"}';
var c = Ext.decode(b);
//{a:'a', b:'b', c:'c'}
对象转字符串
var obj = {a:'a', b:'b', c:'c'}
Ext.encode(obj);
//"{"a":"a","b":"b","c":"c"}"
字符串转对象
var b = '{"a":"a","b":"b","c":"c"}';
var c = Ext.decode(b);
//{a:'a', b:'b', c:'c'}