Merge objects without parsing into JSON

Using JSON parsing removed elements that cannot be expressed in JSON.
The new merge method creates a fresh object and copies keys and values
from the two candidates into it.