json-shape-diff / README.md
vitalipavlovsk's picture
Publish browser-local JSON comparison with tests and limits
917edd2 verified
|
Raw History Blame Contribute Delete
3.52 kB
---
title: JSON Shape Diff
emoji: 🔀
colorFrom: green
colorTo: gray
sdk: static
app_file: index.html
pinned: false
license: mit
short_description: Local JSON comparison with explicit limits
---
# JSON Shape Diff
A small browser-local tool for comparing two parsed JSON payloads. No model
calls, external libraries, analytics or build step. Bundled data is synthetic.
Made with AI assistance for Vitali Pavlovski.
## Use
Paste before/after JSON or open two files, then Compare JSON. Added/removed
paths, type changes and primitive value changes are reported. Actual values
are hidden by default; turn on the explicit checkbox to include them in the
view and downloaded report. Paths and types can still be sensitive.
Filter by change type, search JSON Pointer paths and download the report.
The download includes the full comparison, not only filtered rows. Editing
an input or changing the value-disclosure checkbox clears previous results
and disables download until another comparison. Clear inputs removes input
text and results from the page. It cannot revoke earlier downloads.
## Semantics and limits
- Object key order is ignored. Arrays are compared by index, not ID or edit
distance. Reordering can produce several changes. No semantic equivalence.
- JSON Pointer uses ~0 for tilde and ~1 for slash. Empty path means root.
- Missing differs from null. Added/removed containers are one row, not a
descendant-by-descendant diff. Type changes are one row for that path.
- JSON.parse accepts duplicate object keys using the final value. This tool
does not warn about duplicate keys or validate a JSON Schema.
- JavaScript numeric precision applies. Unsafe parsed integers and non-finite
numbers are rejected; large integers should be strings. Decimal rounding
can still hide distinctions. This is not a lossless text/number diff.
- 500KB per input, 20,000 nodes per input, 80 nesting levels and 3,000 changes.
Reports exceeding the change limit are explicitly marked truncated.
- UI shows up to 300 matching rows. Export includes the entire bounded report.
- Reports can include private values when opted in. Review before sharing.
- No text is uploaded by this app. Ordinary hosting requests still reach
Hugging Face. Browser extensions can have their own access. Data remains
in page memory until cleared or closed; no persistence code is included.
This is not a security scanner, a redaction guarantee, a model or a safety
benchmark. It does not promise every possible difference in arbitrary input.
## Source and reproduction
All source is in this Space: `index.html`, `diff.js`, `tests.cjs`.
Download those files together and open `index.html` locally. No server needed.
Run the engine contracts with a current Node.js installation:
```bash
node tests.cjs
```
20 synthetic engine tests passed: equality/key order, null/missing, type and
value changes, root and escaped paths, array-index behavior, container
changes, values off/on, prototype-named keys, resource caps/truncation,
unsafe numbers and HTML as ordinary data.
Browser checks passed for sample counts, filtering/search, export,
stale-result invalidation, malformed JSON, text-not-HTML rendering, local
file input, reset, desktop/mobile rendering and no page errors. Desktop and
390px mobile layouts were visually inspected. These checks are bounded,
not exhaustive browser or security validation. No paid resources were used.
## License
MIT, see `LICENSE`. AI-assisted implementation directed by Vitali Pavlovski.