json5Diff

fnJson5PatchOp[] json5Diff(var from, var to) @safe

Compute a patch transforming from into to.

The current implementation prioritizes correctness and simplicity:

  • Objects are diffed per-key.
  • Arrays are replaced as a whole when they differ.

    Examples

    import ddn.data.json5 : json5Diff;
    import ddn.var : var;
    
    var a; a["x"] = 1; a["y"] = 2;
    var b; b["x"] = 1; b["z"] = 3;
    auto ops = json5Diff(a, b);
    assert(ops.length != 0);