Vote count:
0
I have a JSON object like this:
[
{ poster_ip: '127.0.0.1',
post_body: 'example',
__v: 0 },
{ poster_ip: '127.0.0.1',
post_body: 'example',
__v: 0 }
]
how can i add an extra element to every nested array so it would be like this:
[
{ poster_ip: '127.0.0.1',
post_body: 'example',
__v: 0,
newName: NewValue },
{ poster_ip: '127.0.0.1',
post_body: 'example',
__v: 0,
newName: NewValue },
]
I tried this but it didn't work:
for(var i=0; i<JSONobject.length; i++){
results[i].newName= NewValue;
}
asked 58 secs ago
How to add an extra element in every nested array of a JSON object?
Aucun commentaire:
Enregistrer un commentaire