Compares two JSON files or HTTP responses to expose added, removed and changed values.
- Nested comparisons.
- Array matching by key.
- Depth and ignore controls.
- Table, minimal or JSON output.
- Optional JSON export.
Prerequisites: Node.js >=18 and npm. The checkout below pins the source used for this documentation.
git clone https://github.com/NickCirv/api-diff.git
cd api-diff
git checkout 0e87551bb94e9acb10f84c96ed36f2fe94730864In the cloned directory:
Create before.json and after.json with these respective values:
{"status":"queued","count":1}Use {"status":"done","count":2} in after.json.
node index.js before.json after.json --format json --exit-codeExpected behavior (illustrative, not captured): Given two JSON files, prints structured differences and exits 1 when differences exist.
Examples are source-inspected, not runtime-tested. See the research record for verification gaps.
Array matching and ignored paths affect what changes are visible. URL inputs make HTTP requests; request bodies and authorization headers must match the endpoint. A schema diff is not a compatibility proof.
The manifest defines npm test as:
node --testThe captured suite is a smoke check, not end-to-end behavior coverage. Examples include “entry is valid JavaScript”, “--help exits 0”. Tests were not run for this documentation revision.
See implementation and command reference for the package scripts and inspected interfaces, and research record for the pinned source, document decisions and unresolved checks.
See LICENSE for the original terms and attribution. Legal text is unchanged.
