js 数组转json,json转数组,对象object转数组array
//数组转json串 var arr = [1,2,3, { a : 1 } ]; JSON.stringify( arr ); //json字符串转数组 var jsonStr = '[1,2,3,{"a":1}]'; JSON.parse( jsonStr ); //对象转数组 function objToArray(obj) { var arr = []; for (let i in obj) { let o = []; o.push(i); o.push(obj[i]); arr.push(o); } return arr; }