-2

I have two JSON objects:

result:{
       name:ABC
       }

and

result:{
       city:PQR
       }

I want to merge both and get output as following:

result:{
       name:ABC,
       city:PQR
       }
ZP Baloch
  • 402
  • 6
  • 18

1 Answers1

0

Use this:

 var obj1 = { name:ABC }
 var obj2 = { city:PQR }

 const merged = Object.assign({}, obj1, obj2);
Majid Parvin
  • 3,689
  • 5
  • 27
  • 41