https://www.cnblogs.com/czh-520/articles/9602801.html
Conversion between a string json, json objects, an array of three
<script> //json字符串、json对象、数组 三者之间的转换 let jsonStr = '[{"id":"01","open":false,"pId":"0","name":"A部门"},{"id":"01","open":false,"pId":"0","name":"A部门"},{"id":"011","open":false,"pId":"01","name":"A部门"},{"id":"03","open":false,"pId":"0","name":"A部门"},{"id":"04","open":false,"pId":"0","name":"A部门"}, {"id":"05","open":false,"pId":"0","name":"A部门"}, {"id": "06", "open" : false, "pId": "0", "name": "A sector"}] json object is converted into a string json//json object is converted into a string json//json object is converted into a string json// the let jsonStr1 the JSON.stringify = (jsonObj)json json string is converted into an object (original method)//var = jsonObj the JSON.parse (jsonStr)//json string into the object to json (method JQ) //= $ .parseJSON (jsonStr); the let jsonObj;' // the console.log (jsonStr1 + "jsonStr1") // json json object into an array of objects into the let of arr1 = []; for (the let I in jsonObj) { // var O = {}; // O [I] = jsonObj [I]; arr1.push (jsonObj [I]); } // the console.log (of arr1); // the console.log (typeof (ARR)); var jsonStr11 = the JSON.stringify (of arr1) // JSON array into json string into // the console.log (jsonStr11); var jsonArr = []; for ( var I in jsonObj){ jsonArr[i] = jsonObj[i]; } //console.log(jsonArr); //console.log(typeof(jsonArr)) </script>
Object is converted into an array of a second embodiment
<Script> // the object into an array of the let {obj = ' unfinished ' : 5 , ' Completed ' : 8 , ' to be confirmed ' : 4 , ' canceled ' : . 6 }; var ARR = []; for (the let I in obj) { // arr.push (obj [I]); // properties // arr.push (obj [I]); // value var O = {}; O [I] = obj [ i]; ARR. push (o); } function objToArray(array) { var arr = []; for (var i in array) { var o={}; o[i]=array[i]; arr.push(o); } console.log(arr); //return arr; } // console.log(arr) objToArray(obj); </script>
About return and return false
1 can terminate the current execution method
2 will only return false to prevent submission of the form.
Find characters:
int index = item.LastIndexOf ( ' \ " ' ); // from the last position of the string began to find whether there is" the symbol