How can we convert javascript __proto__
object to a json string output
this.products.forEach(function(element, index) {
productsInfo.push(productsFormItems[index].myFunction());
});
console.log(JSON.stringify(productsInfo));
myFunction() {
let result = Object.create({
ProductName: { value: this.formData.ProductName },
Address: { value: this.formData.Address }
});
return result;
}
See the sample example below:
Required json format:
"productInfo":[
{
"ProductName":"Testdata"
"Address":"TestValue"
}
]
[
{
"ProductName":"Testdata"
"Address":"TestValue"
}
]