Format and validate JSON

Beautify, minify, and catch errors with line and column.

JSON FormatterFree · never uploaded

Text is processed in this tab and never sent anywhere.

API responses often contain tokens and customer emails. This formatter never posts them. Need text from a screenshot first? Image to JSON.

JSON

0 characters

How to format and validate json

  1. 01

    Paste the payload

    An API response, a fixture, a config. It stays in this tab.

  2. 02

    Format, minify, or sort

    Invalid JSON names the line and column. Valid JSON gets a tree.

  3. 03

    Copy or download

    .json for fixtures. Close the tab to drop the token.

About json formatter

JSON formatters are where API keys go to die. A developer copies a payload from DevTools — access tokens, customer emails, internal IDs — and pastes it into the first “beautify JSON” result on Google. That result is often a server-side pretty-printer with a request log. imissfiles formats, minifies, validates, sorts keys, and draws a collapsible tree in this browser. The string never hits our origin. That is the product, not a footnote.

Formatting and minifying are inverses. Format (beautify) inserts newlines and indentation so a human can read the structure. Pick 2 spaces, 4 spaces, or a tab. Minify strips that whitespace so the payload is small again for a header or a fixture file. Neither changes values. Sort keys is a separate toggle: objects get their keys in alphabetical order, nested, which is useful before a diff so two equivalent objects do not look different because one serializer emitted “z” first.

Validation is the part most toys skip. “Invalid JSON” is not a diagnosis. JavaScript’s JSON.parse error includes a position; we turn that position into a line and column so “Unexpected token } at line 14, column 3” is what you see. Trailing commas, single quotes, and comments are not JSON — they are JavaScript. Remove them, or the tree will not render. An empty box is not an error until you paste something that does not parse.

The tree view is the parsed structure, not a second formatter. Collapse objects and arrays you do not care about. It is a reader, not an editor; change the text on the left and the tree follows after the debounce. If your JSON started as a screenshot of a response, run Image to JSON first (OCR plus a JSON wrapper) and paste the text here to validate it. PDF tables belong in PDF to Text or PDF to CSV, not in a JSON tree.

Use this when the payload is real. Use a throwaway formatter when the payload is {"foo":1}. The difference is whether you would post the string in Slack. We assume you would not. Copy the formatted or minified result, download .json, and close the tab. The working copy is gone. Ads around the workbench never receive the token. If you only needed to count keys, expand the tree. If you needed to compare two payloads, format both with sort-keys on, then send them to Diff Checker — still local, still not a git host.

JSON Formatter FAQ

Why is my JSON invalid?
Trailing commas, single quotes, comments, or a truncated copy. The error names the line and column when the parser gives a position.
What is the difference between formatting and minifying?
Format adds indentation and newlines so you can read it. Minify removes that whitespace. Values do not change.
Does the JSON formatter upload my payload?
No. Parse, format, and the tree all run in this tab. That is the reason to use it on anything with a token in it.
What does sort keys do?
Object keys are rewritten A → Z at every level. Useful before a diff so key order does not look like a real change.
Can I format JSON from a screenshot?
OCR it with Image to JSON, then paste the text here to validate and beautify.
Why no line numbers in the tree?
The tree is the parsed value, not the source. Use the error’s line and column to jump in the text box.

Related tools