JSON 值转换
1 var Txt = '{"a":"1","b":"5","c":"5","d":"6"}'; 2 var arr1 = JSON.parse(Txt); 3 console.log(arr1) 4 // Object {a: "1", b: "5", c: "5", d: "6"} 5 // parse转换的必须是正宗json值 如上 6 var txt = {"a":"1","b":"5","c":"5","d":"6"}; 7 var arr = JSON.stringify(txt); 8 console.log(arr) 9 // {"a":"1","b":"5","c":"5","d":"6"} 10 // stringify可以正常转对象 11 var ttt = {a:"1",b:"5",c:"5",d:"6"} 12 var arr2 = Object.keys(ttt) 13 console.log(arr2) 14 // ["a", "b", "c", "d"] 15 // Object.keys吧对象值都拿出来