File size: 3,518 Bytes
44772a3
917edd2
 
 
 
44772a3
917edd2
44772a3
917edd2
44772a3
 
 
917edd2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
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.