piapia123
en

JSON Structure Inspector

Format

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Paste JSON and get a picture of its shape: nesting depth, total nodes, how many objects and arrays, the type breakdown, the longest array and the longest string. The item most worth looking at is duplicate keys. `JSON.parse('{"a":1,"a":2}')` yields `{"a":2}` — the first `a` disappears without a word. In API work that is a real problem: a server writes the same field in two places, and two people looking at “the same JSON” reach different conclusions, each suspecting the other misread it. This tool scans the raw text to find them and reports where they are. Why this is a separate tool from the formatter: that one answers “how do I look at this JSON” (pretty-print, fold, edit), this one answers “what is this JSON” (how big, how deep, made of what). Same input, entirely different job and interface — statistics bolted onto an already button-dense editor would serve neither. The other three actions are recursive: shuffle, reverse and dedupe all reach every array at every level, not just the outermost one.

Features

  • Nesting depth, total node count, number of objects and arrays
  • Type breakdown (string × 12, number × 5 …), sorted by frequency
  • The longest array, plus every array length listed
  • Longest string length and total string length
  • ⚠️ Duplicate keys: scans the raw text for repeated keys in one object, with path and count, and explains that JSON.parse keeps only the last
  • Shuffle / reverse / dedupe, applied recursively to arrays at every level
  • Dedupe compares values by their JSON text — `1` and `"1"` are different, two identical objects are not
  • Parsing reuses the formatter’s error locator (line and column, and it recognises Python literals)
  • Everything runs in the browser; nothing is uploaded

How to use

  1. Paste your JSON
  2. Leave the action on structure stats — the numbers appear immediately
  3. Look at the duplicate-keys row; it says “none” explicitly when there are none
  4. For tidying up, pick shuffle, reverse or dedupe to get formatted JSON back

FAQ

Why do duplicate keys matter? The value my code reads looks right
Because you are reading the last one. JSON.parse keeps the later value and discards the earlier, and the discard happens at parse time, not read time — so the value you get is “correct”, just not necessarily from the place you assume. The real trouble is collaborative: the server says it returned A, and A is indeed in the JSON you paste (its first occurrence), but your code receives the B that came later. This tool points at both, so you can discuss the same line.
Why not just say JSON must not have duplicate keys?
Because the spec does not forbid it — RFC 8259 leaves the behaviour to the implementation. Parsers disagree: JavaScript keeps the last, Python’s json keeps the last, and some strict parsers reject the document outright. The same file yielding different results in different languages is exactly what makes it dangerous. This tool does not judge; it states the facts.
Where does the depth count start?
The root counts as level 1, so `{"a":1}` has depth 2 (the root object plus the number) and `{"a":{"b":1}}` has depth 3. That makes depth mean “how many nodes you pass through from the root to the deepest value”, which is closer to intuition than counting brace levels.
Is the shuffle cryptographically random?
It uses `Math.random` and a Fisher–Yates shuffle. ⚠️ It deliberately does not use `crypto.getRandomValues`, because the goal is an unpredictable ordering of your data, not cryptographic strength. For unpredictable values (passwords, tokens), use the password generator or random number tools.

Related tools