Reputation: 593
I have an object named session
. It looks like this:
{
"cookie":
{
"expires": null
},
"toDo":
[
{
"name": Taylor,
"id": 0,
"location": boston
}
]
}
I want to add another key-value pair for the temperature to the group under "toDo"
.
I've tried session.toDo.push({'temp; 65});
but I end up with this:
{
"cookie":
{
"expires": null
},
"toDo":
[
{
"name": Taylor,
"id": 0,
"location": boston
},
{
"temp": 65
}
]
}
What I want is this:
{
"cookie":
{
"expires": null
},
"toDo":
[
{
"name": Taylor,
"id": 0,
"location": boston,
"temp": 65
}
]
}
Upvotes: 0
Views: 27