0

Suppose I have 2 json documents of similar structure:

A. {"a:"{"b": 42}}
B. {"a":{"b": 1}}

My task is to find corresponding path in first document while having path of second document. For example, let find the diff of these 2 docuemnts: A diff B. the result will be the document {"a":{"b":1}}. The problem is to find the old value of a.b key in document A. Documents can have arbitrary structure(but structure is same for 2 comparing documents)

EDIT after having val diff = A.diff(B) how to get the document of such structure(or even whithout having diff)?

{"a":
   {"b": 
      {"old": 42, "new": 1}
    }
 }
maks
  • 5,911
  • 17
  • 79
  • 123
  • At least to me, it's very unclear what you're actually after here. – The Archetypal Paul Nov 26 '15 at 21:24
  • I've edited the question – maks Nov 26 '15 at 22:00
  • Well, that's not helped much. You now state two different results for A diff B - one is just B, and one is a sort of merge. Maybe someone else can work out what you mean, I don't see it. – The Archetypal Paul Nov 27 '15 at 07:13
  • You now state two different results for A diff B - one is just B - If you think so, then you don't know how `diff` works. It returns a `Diff` object with `changed`, `added` and `removed` values. While `added` and `removed` will be empty, `changed` will contain the diff between A and B which is obviously(in this case) just a B, but I said that documents can have any structure also. – maks Nov 27 '15 at 08:31

0 Answers0