-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
       }
2

1 Answer 1

0

Use this:

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

 const merged = Object.assign({}, obj1, obj2);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.