How can the array be converted to json so that it can be submitted to the background by form?

Hello, everyone. I have a js array that I want to submit to the background by post.

the array format is as follows:

dateList: [
{name: "1", cn: "11"},
{name: "2", cn: "22"},
{name: "3", cn: "33"}
]

then you want to submit it to the background in the form of
formData.append ("dataList", dataList)
).

but the result given by the feedback is that it is not possible to submit it directly. I looked up the information and seemed to say that I would first convert it to json, and then submit it.

how can I convert this array to json?

?
Mar.13,2021

serialize the data, JSON.stringify (dateList)

Menu