我在我的项目中使用了角度2,这是我的json对象:
{"departure":"ville","stations":[{"station":"r"}]}
我想要的是用{{“station”:“Rabat”}替换[{“station”:“r”}],预期的对象是:
{"departure":"ville","stations":[{"station":"Rabat"}]}
任何帮助吗??
答案 0 :(得分:0)
你可以做到
let obj = {"departure":"ville","stations":[{"station":"r"},{"station":"j"},{"station":"i"}]};
console.log(obj);
obj.stations = [{"station":"toto"},{"station":"titi"},{"station":"momo"}];
console.log(obj);