I've tried to destruct a json. This is the original:
const shoppingLists = [
{
id: 0,
name: "empty shopppinglist",
location: "",
targetDate: "",
priority: "",
isFinished: false,
items: [{
name: ""
}]
},
{
id: 1,
name: "full shopppinglist",
location: "migros",
targetDate: "",
priority: "1",
isFinished: true,
items: [{
name: "apfel"
}]
}}
I need now just the lists with the elements but without the items list
const { id, name, location, targetDate, priority, isFinished } = shoppingLists
res.send(shoppingLists)
But when I receive/log shoppingLists, I always get again the whole object.
I've also tried with items, ...rest but same result at the end, what am I doing wrong?