I have a json array
[{id:1,data:"test1"},{id:2,data:"test2"}]
I need to add a new element to each of the objects in the array based on the value of the "data" field. That is if the value of data is "test1", the new field data should be "test one type". The expected output is as below
[{id:1,data:"test1",type: "test1 Type"},{id:2,data:"test2",type: "test2 Type"}]
I tried with .push operation but it is adding new object to the array not updating the existing object. I am new to node NodeJs. Can you please help with this.