Add 2 json objects according to keys in java

Viewed 147

I am working on Json Objects in java!. I have 2 json objects as follows:

{"a":{"num1":5},"b":{"num1":8}}

{"a":{"num2":7},"b":{"num2":9}}

I want to create a single json object as:

 {"a":{"num1":5,"num2":7},"b":{"num1":8,"num2":9}}

How should i merge the 2 objects to achieve the above result?

2 Answers
Related