[Solved] How to add key value pair to the json?

[ad_1]

You can do something like this:

var students = [ { city: 'California', company: 'ABC'}, { city: 'LA', company: 'PQR'}, { city: 'Mumbai', company: 'XYZ'}];
        
students.forEach((obj) => {
  obj['email']= '[email protected]';
  console.log(obj);
});

// Final Output
console.log(students);

0

[ad_2]

solved How to add key value pair to the json?