Json字符串和Json对象相互转换
字符串-->json对象:JSON.parse()
var str = '{"code":"A001","name":"张三"}'; JSON.parse(str); 结果: code: "A001" name: "张三"
json对象-->字符串:JSON.stringify()
var obj = {code:"A001",name:"张三"}; JSON.stringify(obj); 结果: "{"code":"A001","name":"张三"}"