json diff tool
npm install alu-json-diffUse the command line to compare two folders with the same directory structure and output their differences
If used alone, you can compare two json objects and output the difference (added, removed, edited)
``sh`
npm install -g alu-json-diff
Cli
`sh`
alu-json-diff oldSourceDirPath newSourceDirPath -o ./dist
Simple usage:
`ts
import { diff } from "alu-json-diff";
const struct1 = {
a: 1,
b: [{ c1: [{ c3: { c5: [1, 2, { c6: 3 }] } }, { c4: 6 }] }, { c2: 2 }],
};
const struct2 = {
a: 11,
b: [{ c1: [{ c3: { c5: [1, 2, { c6: 4 }] } }, { c4: 6 }] }, { c2: 2 }],
};
let result = diff(struct1, struct2);
console.log(result);
// {
// edited: [
// ['a', 1, 11],
// ['b[0]/c1[0]/c3/c5[2]/c6', 3, 4]
// ],
// added: [],
// removed: []
// }
``