It slipped my mind to mention that my product object contains nested objects. Huge thanks to W.S for providing the valuable information.
I found this answer very useful
in guiding me on how an object should be structured for ASP.net applications. Here is the format it should take in my scenario:
product.id *value*
product.supplierId *value*
product.supplierName *value*
product.title *value*
product.description *value*
product.vendor *value*
product.vendorId *value*
product.documents[0].id *value*
product.documents[0].url
product.documents[0].keywords
product.attributes[0].attributeId *value*
product.attributes[0].attributeName *value*
product.attributes[0].type A
product.attributes[0].value 2
Following this, I utilized the code below to transform my object into a compatible view:
productEntriesIteration(object:object, j:number, nestedKey:string) {
Object.entries(object).forEach(([key, value], i)=> {
if (value) {
if (typeof value == "string") {
this.appendSingleField(key, nestedKey,j,value);
}
else if (typeof value == "number") {
if ( Number(value) === Number(value) && Number(value) !== (Number(value) | 0)) {
value = value.toString().replace(".", ',')
}
this.appendSingleField(key,nestedKey,j,value)
}
else if (typeof value.getMonth === 'function') {
this.appendSingleField(key, nestedKey, j, value.toISOString())
}
else if (Array.isArray(value)) {
for (let val in value) {
if (typeof value[val] == "object") {
this.productEntriesIteration(value[val], Number(val), key)
}
else if (typeof value[val] == "number"){
this.appendSingleField(key, nestedKey, j, value[val])
}
else {
this.appendSingleField(key, nestedKey, j, value[val])
}
}
} else if (typeof value == "object") {
this.productEntriesIteration(value, -1, key)
}
}
})
return this.formData
}
appendSingleField(key:string, nestedKey:string, i:number, value:any) {
if (i == null) {
this.formData.append('product.'+key+'',value)
} else if (i == -1) {
this.formData.append('product.'+nestedKey+'.'+key,value)
} else {
this.formData.append('product.'+nestedKey+'['+i+'].'+key,value)
}
}
I trust this explanation will benefit others in similar situations