The example in this article describes how jQuery parses json format data. Share it with everyone for your reference, the details are as follows:
The version of jquery I use is 1.7.2, which integrates the parsing function of json data. It was not available in very early versions. I remember that at that time, you could either use the for in of js to read the data in the json string. Either load a JS file specifically used to parse json strings.
Example:
<html> <head> <script type="text/javascript" src="jquery-1.7.2.min.js"></script> <script> $(document).ready(function () { var json_string = '[["a","b","c"],[1,2,3]]'; //二维数组,json_encode后的字符串 json_array = JSON.parse(json_string); //json解析 for(i=0;i<json_array.length;i++){ for(j=0;j<json_array[i].length;j++){ alert(json_array[i][j]); } } }); </script> </head> <body> </body> </html>
Readers who are interested in more content related to jQuery operating json can check out the special topic of this site: "A summary of jQuery operating json data techniques"
I hope this article will be helpful to everyone in jQuery programming.