-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
  • 7
  • 19

1 Answers1

0

Use this:

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

 const merged = Object.assign({}, obj1, obj2);
Majid Parvin
  • 4,499
  • 5
  • 29
  • 47