This is really weird I think, I have this json
being sent through http.
{
"foo":"bar",
"foo2":"bar2",
"name":{
"firstName":"Joff",
"middleName":"Ramirez",
"lastName":"Tiquez"
}
}
On the server I was performing these commands:
var data = req.body; // the json from http
console.log('data', data); // the data now has the req.body's value
delete data.name; // <-- here's the delete
console.log('data', data); // the name object will obviously be deleted
console.log('req.body', req.body); // the name on the req.body was deleted too. Wtf?
So when I tried to use the req.body.name
on the other parts of my program, the name
is now gone. Is that how delete
is supposed to work?