Reputation: 67
Here is my List
{ $id: "1"
cashOnDeliveryCharges: ""
deliveryMethod: ""
order_date: "06-12-2019"
order_no: "ORD000105"
paymentMethod: "Shopping Wallet"
registered_email: "[email protected]"
shippingAddress: "DELDD, 2981, 161, 13-8269"
shippingCharges: ""
store: ""
total: "AED 3600.00"
items: {$id: "2", name: "Batch Soap", qty: 8, amount: 450, productId: 15}
}
Here I don't want "$id" from this List Please any one help me
Upvotes: 1
Views: 94
Reputation: 7739
You can use delete;
Try this:
let item = {
$id: "1",
cashOnDeliveryCharges: "",
deliveryMethod: "",
order_date: "06-12-2019",
order_no: "ORD000105",
paymentMethod: "Shopping Wallet",
registered_email: "[email protected]",
shippingAddress: "DELDD, 2981, 161, 13-8269",
shippingCharges: "",
store: "",
total: "AED 3600.00",
items: { $id: "2", name: "Batch Soap", qty: 8, amount: 450, productId: 15 }
}
delete item['$id'];
delete item.items['$id'];
console.log(item);
Upvotes: 1