The input parameters of the axios request are in the form of objects in the array, which is not as expected after being converted with qs.stringify ().

there are post request parameters like this

requestObj = {
   staffList: [{
       staffId: "xxx",
       availableQuota: 10
   }, {
       staffId": "xxx",
       availableQuota: 14
   }]
}

axios({
    method: "post",
    url: url,
    data: qs.stringify(requestObj, {arrayFormat: "brackets"})
})
After

processing, it becomes like this, like a two-dimensional array

what I hope is

staffList[0].staffId: "xxx"
staffList[0].availableQuota: 10
staffList[1].staffId: "xxx"
staffList[1].availableQuota: 14
Apr.25,2021

requestObj use JSON.stringify () to see


first serialize the array staffList with JSON.stingify (), and then use qs.stringify


answer: with the help of colleagues, Read the document: qs.stringify (data, {arrayFormat: 'indices', allowDots: true}) ,
you can generate the format I need


if the background interface receives an array, there is a simpler way without qs, data can directly send staffList, that is, remove the outer curly braces.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b3d5-2c291.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b3d5-2c291.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?