js相关知识
1.对象转字符串
a. var a = {id:'1',name:'xiaoming'}
JSON.stringify(a) => "{"id":"2","name":"xiaofang"}"
b. var arr=[1,2,3,4] 也是一个对象
JSON.stringify(arr) => "[1,2,3,4]"
2.符串转字对象
var b = "{"id":"2","name":"xiaofang"}"
JSON.parse(b) => {id:'1',name:'xiaoming'}
eval()性能较差,不推荐
--未完待续--