Modifying a JSON array (nested into another array) seems NOK with this code:
var names = [{'name': 'ourname'},{'name': 'yourname'}] ;
var array = [{
"year": "2015",
names
},{
"year": "2016",
names
}];
I can't modify a single name entry in "array" by doing this
array[0].names[1].name="MY NAME"
since it's actually modifying all names entry in the row "0":
Output:
0:0 ourname
0:1 MY NAME
1:0 ourname
1:1 MY NAME
Plunker here
I'm looking for a clean way to achieve a proper single modification in the name array as I'd like to avoid loops to do this.
Thanks for your help