In JS, an array is often converted to a JSON string to be sent to the backend.
This time, when defining an array data structure, it is important to note that there is a difference between a collection and an object in the JSON.
The definition of a collection is []; the definition of an object is {}.
At this point, the array needs to be created in a different way. For example, create a collection array:
varBizhi_info_modify_arr = [];
Then create an array of objects:
Bizhi_info_modify_arr[i] = {};
bizhi_info_modify_arr[i]["id"] =$ ("#bizhi_list_id" +i). Val ();
bizhi_info_modify_arr[i]["Bizhi_list_provider"] =$ ("#bizhi_list_provider" +i). Val ();
bizhi_info_modify_arr[i]["Bizhi_list_catalog"] = $ ("#bizhi_list_catalog" +i). Val ();
The difference is that the collection array is just a collection, the key is no value, and the object array key has a value.
This makes it very simple to generate a JSON string, just call the system function json.stringify.
jsonstr = json.stringify (Bizhi_info_modify_arr);
Considerations for turning a JS array into a JSON string