I have two JSON files. I want to combine them into one in such a way that the second file has a greater priority. That is:
- if 1 has the property
fooand 2 has no propertyfoo, 3 will have the propertyfoowith the value from 1. - if 2 has the property
fooand 1 has no propertyfoo, 3 will have the propertyfoowith the value from 2. - if 1 and 2 both have the property
foo, 3 will have the propertyfoowith the value from 2.
I need to do this in Java. The final JSON object will be deserialized to a Java object with Google Gson.