I have a JSON (All under req.body) in the format
{body :
{ Cust : {...} },
{ Input : {...} },
{ Reciept : {image: [Array] } }
}
I want to be able to remove all the key Reciept so the new JSON would look like ...
{body :
{ Cust : {...} },
{ Input : {...} }
}
I've tried to use delete req.body.Reciept
and delete req.body.Reciept.image
Both are unable to change the JSON for me.
What should I be doing?
edit: When I console log req.body this is what I get :
{ body:
{ CustData:
{ customer: 'T',
address1: '',
address2: '',
billing: '',
signature: [Object] },
InputData:
{ InputDate: '2019-10-21 23:25:28',
Workers: [],
Equipment: [],
Purchases: [] },
Reciept: { image: [Array] } } }
I haven't found a solution because I have a JSON and then an array as a value for a key. I am simply trying to remove the whole Reciept key and everything attached to it.
Here is what is I am running
console.log(req.body);
delete req.body.Receipt;
console.log(req.body);
Here is what I get returned in the terminal
{ body:
{ CustData:
{ customer: 'Test',
address1: '',
address2: '',
billing: '',
signature: [Object] },
InputData:
{ InputDate: '2019-10-22 0:9:33',
Workers: [],
Equipment: [],
Purchases: [] },
Receipt: { image: [Array] } } }
//followed by
{ body:
{ CustData:
{ customer: 'Test',
address1: '',
address2: '',
billing: '',
signature: [Object] },
InputData:
{ InputDate: '2019-10-22 0:9:33',
Workers: [],
Equipment: [],
Purchases: [] },
Receipt: { image: [Array] } } }