Write a function that accepts two deeply nested objects or arrays obj1 and obj2 and returns a new object representing their differences.
The function should compare the properties of the two objects and identify any changes. The returned object should only contain keys where the value is different from obj1 to obj2. For each changed key, the value should be represented as an array [obj1 value, obj2 value].
Important: Keys that exist in one object but not in the other should not be included in the returned object. The end result should be a deeply nested object where each leaf value is a difference array.
When comparing two arrays, the indices of the arrays are considered to be their keys. You may assume that both objects are the output of JSON.parse.
Input & Output
Constraints
- Objects are valid JSON structures
- Nested depth ≤ 100 levels
- Total properties ≤ 104