How can I merge two similar JSON files in JavaScript, where elements from each are combined into a new associative array in a specific pattern?
For example:
var JSON1 = {'Item 1':123, 'Item 2':234, 'Item 3': 345}
var JSON2 = {'Item 1':555, 'Item 2':666, 'Item 3': 777}
var newArray = {'Item 1':123, 'Item 1':555, 'Item 2':234, 'Item 2':666, 'Item 3': 345, 'Item 3': 777}
Although the actual JSON files have nested arrays, I only need to mix the first level elements together in the specified way.
While there are many solutions for merging arrays, I have not found one that fits this specific scenario. Any suggestions?