I have an object that looks something like this:
{ "_id": "DEADBEEF", "_rev": "2-FEEDME", "name": "Jimmy Strawson", "link": "placeholder.txt", "entries": { "Foo": 0 } }
What is read in my javascript with a call to $ .getJSON.
So, I have a JS response object that contains all this data.
I need to add elements such that the "records" expand as follows:
{ "_id": "DEADBEEF", "_rev": "2-FEEDME", "name": "Jimmy Strawson", "link": "placeholder.txt", "entries": { "Foo": 0, "Bar": 30, "Baz": 4 } }
I tried
reply['entries'].push({"Bar": 0});
But this does not work (I suppose because nothing is an array)
Can someone provide an alternative method?
source share