This article describes jQuery parsing json format data. Share it for your reference, as follows:
var arr1 = [ "one", "two", "three", "four", "five" ]; $.each(arr1, function(){ alert(this); });
Output:
one two three four five
var arr2 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] $.each(arr2, function(i, item){ alert(item[0]); });
Output:
1 4 7
var obj = { one:1, two:2, three:3, four:4, five:5 }; $.each(obj, function(key, val) { alert(obj[key]); });
Output:
1 2 3 4 5
//json formatvar param = [{'subJobClass':'','subJobMethod':'hello','taskParam':[{'username':'Zhang San'},{'age':'28'},{'tel':'15818821129'}]}]; //Set parameter valueif(>0){ alert(param[0].subJobClass); alert(param[0].subJobMethod); var taskParam = param[0].taskParam ; //Transfer the task parameter array (taskParam,function(i, item){ //Resolve individual task parameters (item ,function(key){ alert(key);//key alert(item[key]);//value }); }); }
Interested friends can use itOnline HTML/CSS/JavaScript code running tool:http://tools./code/HtmlJsRunTest the above code running effect.
PS: Regarding json operation, here are some more practical json online tools for your reference:
OnlineJSONCode verification, inspection, beautification and formatting tools:
http://tools./code/json
JSONOnline formatting tools:
http://tools./code/jsonformat
Online XML/JSONConvert each other tools:
http://tools./code/xmljson
jsonCode online formatting/beautification/compression/editing/converting tools:
http://tools./code/jsoncodeformat
OnlinejsonCompression/escaping tools:
http://tools./code/json_yasuo_trans
For more information about jQuery, you can also view the topic of this site: "Summary of jQuery operation json data skills》、《Summary of commonly used plug-ins and usages of jQuery》、《Summary of jQuery extension skills"and"Summary of jquery selector usage》
I hope this article will be helpful to everyone's jQuery programming.