json formatter and validator

runs in your browser, nothing is uploaded

IDLE

stdin

stdout

Made by Maiyarasu S

Paste JSON, drop a file or open one, and get a formatted, foldable tree, or the exact line and column of the first error. Everything happens in this page: your data is not uploaded, and the tool keeps working without a connection once it has loaded.

What it checks

The parser is strict. Anything that is not valid JSON is reported with its line, its column and a caret under the problem, in plain words such as “Trailing comma before }” or “Keys need double quotes”. Valid input is shown as a tree you can fold, with 2-space, 4-space or tab indentation and an option to sort keys.

It also notices things a plain validator lets through. Duplicate keys are listed with the line of each copy, because most programs keep only the last one. Integers too large for JavaScript to hold exactly, such as 9007199254740993, keep every digit. Several documents on separate lines are read as JSON Lines.

Large files and odd values

Files up to 20 MB can be opened or dropped onto the input. Large input is parsed in a background thread so the page stays usable, and the tree draws the first levels, then fills in the rest as you open it.

Numbers that look like Unix timestamps show their date, links are clickable, and strings that hold JSON, base64 text or a JSON Web Token get a badge that expands them in place. Click any row to see its path, copy it, or use it as a query.

Questions

Is my JSON sent to a server?

No. Parsing, formatting and every other step run in this page. Input is saved in this browser so it survives a reload, and you can clear it from the help dialog.

Can it fix JSON that is not valid?

Often, yes. The error view lists the repairs auto-fix would make, such as removing comments or trailing commas, before you apply it. Undo brings your original back.

Does it change my numbers?

No. Numbers keep the spelling they were written with, so 1.50 stays 1.50 and long integers keep every digit.

Are there keyboard shortcuts?

Yes. Ctrl+Enter formats the input in place, Ctrl+F or / searches, the arrow keys move through the tree, and ? lists the rest.

Related tools

help

QUERY (the prompt line)

Type a path or a filter after guest@json:~$. JSONPath and a jq-style subset both work, and the output shows only the result. Convert, copy and save then apply to that result.

$.users[0].nameone value by path. .users[0].name is the same thing
$["odd key"] $.ports[-1] $.ports[1:3]quoted keys, counting from the end, slices
$.users[*].name or .users[].nameevery item
$..namethat key at any depth
$.users[?(@.id > 1001 && @.sudo)]filter. Operators: == != < <= > >= && || !
.users[] | select(.sudo) | .namethe same idea in jq style, with pipes
.users | map(.name) | sortbuild a new list
[.users[] | select(.sudo)] | lengthcollect matches into an array, then count

Functions: length, keys, keys_unsorted, values, type, first, last, sort, sort_by(f), unique, reverse, flatten, add, min, max, to_entries, not, select(f), map(f), has(k), test(regex), contains(x), startswith(s), endswith(s).

TABS A AND B

stdin has two tabs. diff compares a with b by structure: key order is ignored, and an item inserted into an array counts once. validate checks tab a against the JSON Schema in tab b. Click any row in either list to open that spot in the tree.

REPAIR

When input is not valid JSON, the error view lists what auto-fix would change, line by line, before you apply it: comments, trailing or missing commas, single or smart quotes, bare keys, NaN and Infinity, hex and other number spellings, markdown code fences, JSONP wrappers, and input that was cut off. undo brings your original back.

VALUE HINTS

Links are clickable. Numbers that look like Unix times show the date. A badge after a string means it holds something: {…} JSON, jwt a token (decoded, never verified), b64 base64 text. Click the badge, or press Enter on the row, to expand it in place. A token pasted on its own, with or without Bearer in front, is offered as decode jwt instead of a parse error. Decoding never checks the signature.

KEYS

Ctrl+F or /search the output: the tree, or the text of minify, yaml, csv and ts. Enter next match, Shift+Enter previous. Write /pattern/ for a regular expression. In text output the keys and values buttons are off, and diff and validate switch to the tree
Alt+Qgo to the query prompt. Esc clears it
↑ ↓ ← →move in the tree. Left and right fold and unfold, with Shift they do the whole branch
Enter / Ctrl+C in the treefold or expand the row / copy the selected value
Ctrl+Enterformat stdin in place
Ctrl+Ssave the output as a file
Alt+C Alt+M Alt+S Alt+Fcopy, pretty or minify, sort keys, fold
Alt+1 Alt+2 Alt+Ttab a, tab b, next theme
Tab / Shift+Tab in stdinindent and outdent. Press Esc first to tab out of the box instead
Ctrl+Z / Ctrl+Shift+Z in stdinalso undo and redo format, auto-fix, load and clear

On a Mac, use Cmd for Ctrl and Option for Alt.

SAVED INPUT AND DISPLAY

Both tabs are kept in this browser between visits, however large. If the browser cannot keep an input, a note says so. The crt button turns scanlines and glow off. The page also drops them, and brightens dim text and borders, when your system asks for more contrast.

PRIVACY

Everything runs in this page, and the fonts are served with it. Nothing you paste is sent anywhere. A share link holds the compressed input inside the link itself, so anyone you send the link to can read it.

What you paste is also saved in this browser, so it is still here on your next visit. On a shared computer, or after pasting a secret, clear it. This removes both tabs and your settings from this browser.