Jquery ajax submission parameter problem

  node.js, question

Hello, everyone, I have a small white front one.

Recently, using jquery.datatables plug-in to enable the serverSide option found that his ajax parameters look like this in the browser inside.

draw:1
 columns[0][data]:name
 columns[0][name]:
 columns[0][searchable]:true
 columns[0][orderable]:true
 columns[0][search][value]:
 columns[0][search][regex]:false
 columns[1][data]:mobilePhone
 columns[1][name]:
 columns[1][searchable]:true
 columns[1][orderable]:true
 columns[1][search][value]:
 columns[1][search][regex]:false
 columns[2][data]:email
 columns[2][name]:
 columns[2][searchable]:true
 columns[2][orderable]:true
 columns[2][search][value]:
 columns[2][search][regex]:false
 columns[3][data]:registerDate
 columns[3][name]:
 columns[3][searchable]:true
 columns[3][orderable]:true
 columns[3][search][value]:
 columns[3][search][regex]:false
 order[0][column]:0
 order[0][dir]:desc
 start:0
 length:10
 search[value]:
 search[regex]:false

This seems to be the result of jquery serializing parameters

However, the parameters received in the background are not nested objects but like this

columns[0][data]: "name"
 columns[0][name]: ""
 columns[0][orderable]: "true"
 columns[0][search][regex]: "false"
 columns[0][search][value]: ""
 columns[0][searchable]: "true"
 columns[1][data]: "mobilePhone"
 columns[1][name]: ""
 columns[1][orderable]: "true"
 columns[1][search][regex]: "false"
 columns[1][search][value]: ""
 columns[1][searchable]: "true"
 columns[2][data]: "email"
 columns[2][name]: ""
 columns[2][orderable]: "true"
 columns[2][search][regex]: "false"
 columns[2][search][value]: ""
 columns[2][searchable]: "true"
 columns[3][data]: "registerDate"
 columns[3][name]: ""
 columns[3][orderable]: "true"
 columns[3][search][regex]: "false"
 columns[3][search][value]: ""
 columns[3][searchable]: "true"
 draw: "1"
 length: "10"
 order[0][column]: "0"
 order[0][dir]: "desc"
 search[regex]: "false"
 search[value]: ""
 start: "0"

Nodejs can correctly convert req.query into an object when getting a request, but req.body is like the above when post

However, java spring does not accept this kind of parameter passing at all.

How can java spring and nodejs’s bodyparser receive jquery’s json serialization parameters?

The simplest way is to use JSON

jsvar data = {
 columns: [ .... ]
 };
 
 $.ajax(url, {
 json: JSON.stringify(data)
 });

After getting json in the background, it can be deserialized into objects. For example, Java can use fastjson, and nodejs can directly use JSON.parse (…)