使用javascript将对象附加到formData

时间:2019-02-25 17:30:11

标签: javascript vue.js

如何将以下对象更改为formData,并在将结果发布到API之前将结果发布为formData类型。我尝试了formdata.append('name',myobject)但没有用。结果是['object object']。而且我还更改了API调用的内容类型,但仍然如此。

{
"companyInfo":
{
"companyName":"Trest name",
"tradeName":"test",
"website":""
},
"contact":
[
{
"type":"primary",
"name":"first koss",
"designation":"Mr",
"email":"email@email.com",
"mobile":"2343234",
"phone":"6789"
},
{
"type":"secondary",
"name":"first",
"designation":"Mr",
"email":"email@email.com",
"mobile":"2343234",
"phone":"6789"
}
],
"businessInfo":
{
"name":22,
"email":"Estimated",

},
"directors":
[
{
"name":"Prine Doe",
"email":"email@email.com",
"mobile":"345325",
"phone":"435345",
"directorIDCart":"jewuiev/duviuv.jpg"
}
],
"bankInfo":
{
"bank":"Bank name",
"bankBranch":"bank branch",
},
"document":
{
"productDescription":"qwerewfewrfercecc",
"documentPath":"ajuiuiv/verve/evrfver.png"
}
}

0 个答案:

没有答案