Tell me what are the algorithms for comparing trees and various kinds of multidimensional structures. In particular, json is interested.

those. if we have two structures A and B.

I want to get the difference between A to B (let's call it Ab), and B to A (Ba).

that at merge (||) it turned out so:

B||Ab = A A||Ba = B 

    0