在 formdata 追加期间如何不使用字符串到对象数组?
how can i get without use string to array of object during formdata append?
我想通过 formdata append 发送对象数据数组。我正在向后端服务器获取一个数组,但是关闭字符串'[]'会出现一个对象数组,比如 this.so 我想删除这个 selfclose 字符串。所以请帮助我,我该如何解决这个问题?
我要这个......
varientDetails: ['{"index":0.40051008889580997,"sort":"45","sku":"5","waightorquantity":"100","Unit":"ghg","mrp":"gj","discount":"iy","price":"","stock":"","minstock":"","outofstock":""}']
但我想要这样的数据:
varientDetails: [{"index":0.40051008889580997,"sort":"45","sku":"5","waightorquantity":"100","Unit":"ghg","mrp":"gj","discount":"iy","price":"","stock":"","minstock":"","outofstock":""}]
我正在使用这种方法
varientDetails.forEach(varient => {
formData.append(`varientDetails[]`, JSON.stringify(varient))
})
我想通过 formdata append 发送对象数据数组。我正在向后端服务器获取一个数组,但是关闭字符串'[]'会出现一个对象数组,比如 this.so 我想删除这个 selfclose 字符串。所以请帮助我,我该如何解决这个问题?
我要这个......
varientDetails: ['{"index":0.40051008889580997,"sort":"45","sku":"5","waightorquantity":"100","Unit":"ghg","mrp":"gj","discount":"iy","price":"","stock":"","minstock":"","outofstock":""}']
但我想要这样的数据:
varientDetails: [{"index":0.40051008889580997,"sort":"45","sku":"5","waightorquantity":"100","Unit":"ghg","mrp":"gj","discount":"iy","price":"","stock":"","minstock":"","outofstock":""}]
我正在使用这种方法
varientDetails.forEach(varient => {
formData.append(`varientDetails[]`, JSON.stringify(varient))
})