my Json looks like
[{"name":"a","value":1},
{"name":"b","value":2},
{"name":"c","value":3},
{"name":"d","value":4}]
Get these Json data to my project by ,
this.http.get('http://localhost:8000/names')
.map(response=>response.json())
.subscribe(data=>{this.names = data});
"name":"new","value":5
i tried like this :
for(i in this.alldepartment){}
// alert(i) -> it alerts 3
this.names[++i]["name"]="new";
this.names[++i]["value"]=5;
alert(JSON.stringify(this.names));
But it will not work.I want to become
[{"name":"a","value":1},
{"name":"b","value":2},
{"name":"c","value":3},
{"name":"d","value":4},
{"name":"new","value":5}]
Is there any solution for this?