I have not known the difference between Jsonarray and Jsonobject, and today I finally figured it out.
Jsonarray is an array that contains data with [], Jsonobject is an object, and {} contains data.
Introduce an easy way to build a jsonarray in the foreground
var array=[]; for (int i=0;i<10;i++) { var item={}; Item.a= "a" +i; item.b= "B" +i; Array.push (item); } ajax:params:{data:JSON.stringify (array), type:1}
In the background you can receive:
String data=request.getparameter ("array"); Jsonarray myarray=jsonarray.fromobject (data); for (int i=0;i<myarray.size (); i++) { jsonobject object=myarray.getjsonobject (i); String a = object.getstring (' a '); String B = object.getstring (' b '); }
The above JS created Jsonarray transmission to the background and the background of a comprehensive analysis is a small part of the whole content to share to everyone, I hope to give you a reference, but also hope that we support the script home.
Jsonarray Turn Jsonobject