Closed deverton closed 12 years ago
Actually, any object type (null, array, object) being deleted from the middle of an array triggers this one.
@Test public void testArrayObjectsWithNullAndChanges() { String from = "{\"a\":[{\"c\":2,\"d\":3},null,{\"c\":2,\"d\":3}]}"; String to = "{\"a\":[{\"c\":2,\"d\":3},{\"c\":2,\"d\":7}]}"; String diff = "{\"-a[1]\":0,\"~a[2]\":{\"-d\":0},\"~a[1]\":{\"d\":7}}"; String d = JsonDiff.diff(from, to); Assert.assertEquals(diff, d); String p = JsonPatch.apply(from, diff); Assert.assertEquals(to, p); }
This forced me to be much stricter for operation order. Operations are now applied: delete, insert, set, merge.
Actually, any object type (null, array, object) being deleted from the middle of an array triggers this one.