admin@likeapro.dev: ~/json — zsh

// admin tools · 08

JSON formatter

Pretty-print or minify JSON, pin syntax errors to the exact line and column, repair sloppy JSON5-ish input, then explore big payloads as a lazy tree or query them with JSONPath.

// runs locally — nothing is uploaded

indent
output

                                
FORMAT local only · 0 bytes sent --:--:--

How it works

What it does

Paste or drop JSON and it is parsed as you type. Valid input is pretty-printed with 2 or 4 spaces or tabs, or minified, optionally with every object's keys sorted alphabetically — handy before diffing two payloads. Invalid input gets a precise line and column, a plain-English reason and a caret under the exact character. Everything runs in this tab; the JSON never leaves your browser.

How to use it

  1. Paste JSON into the input, press open to load a file, or drop one onto the box.
  2. --format shows the formatted output. Copy it, or send it back to the input with use as input.
  3. --tree renders a collapsible view. Click any key to copy its JSONPath, such as $.team[2].skills. Arrow keys move, expand and collapse.
  4. --query evaluates a JSONPath expression and lists every match with its path.

Why write our own error locator?

Every browser words JSON.parse failures differently, and some only give a character offset. This tool re-scans invalid input with a strict, iterative RFC 8259 scanner, so you get the same answer in every browser: trailing commas, single quotes, unquoted keys, comments, leading zeros, bad escapes, raw line breaks inside strings, mismatched brackets (with where the opener was) and stray text after the value.

Lenient repair

Hand-edited config often looks like JSON5 or JavaScript. lenient repair rewrites it token by token: comments (//, /* */, #) are dropped, trailing and doubled commas removed, single-quoted strings and bare keys double-quoted, True/False/None lowered, NaN, Infinity and undefined become null, and .5, +3 and 0x1F become plain numbers. It reports exactly what it changed. It won't guess at missing commas or brackets — those need a human.

Stats and limits

size
UTF-8 bytes of the input, not characters.
keys
Total object keys at every level.
depth
Deepest nesting level; a bare value is depth 1.
precision
Integers beyond 253 can't be represented exactly in JavaScript, so they are flagged — quote IDs like that as strings.

Multi-megabyte files are fine: parsing is debounced, highlighting switches off above ~400 KB, and the tree only builds nodes as you open them, 200 children at a time.

FAQ

Is my JSON sent anywhere?

No. Parsing, formatting, the tree and queries all run in JavaScript in this page. Files are read with the browser's FileReader and never uploaded.

Does sorting keys change my data?

Only the order of object keys. Array order is kept, because it is meaningful. JSON objects are unordered by spec, so a sorted copy is equivalent.

What happens to duplicate keys?

Like JSON.parse everywhere, the last value wins and earlier ones are dropped from the output. If duplicates matter, fix them at the source.

Which JSONPath features work?

A practical subset: child and bracket access, negative indexes, unions, wildcards, slices, recursive descent and simple filters comparing @ fields with literals. Script expressions are deliberately not supported — nothing you type is ever executed.