Can't send nested json object to node express tag parser
Hi I am creating a sample REST api using Node, Express and Mongo. I am using the average bodyParser () technique to parse form data. His working tone for a simple object says
var user = {
name:'test',
age:'20'
}
req.body creates the same set of formats to store in mongodb.
{
name:'test',
age:'20'
}
When using a complex object
var user = {
name:'test',
age:'20',
education: {
institute:"xxx",
year:2010
}
}
req.body creates a different format like
{
name:'test',
age:'20',
education[institute]: "xxx",
edcuation[year]:2010
}
I would like to receive the same format that I am sending in the body to store them in the database. Is this the correct approach or any other method available for this?
+3
source to share