JSON Formatter

Free JSON formatter and validator: beautify or minify JSON with 2 or 4 spaces or tabs, sort keys, and see the exact line, column and reason for any error.

Everything happens in your browser. Nothing is uploaded.

Make JSON readable and find the exact error

API responses, config files and log entries often arrive as a single unbroken line of JSON, and a single misplaced comma makes the whole thing invalid. This formatter indents JSON so the structure is visible, compacts it again for production, and, most usefully, tells you the line, the column and the reason when something is wrong, then moves the cursor straight to the faulty character.

How to use it

  1. Paste into Your JSON.
  2. Choose an Indent: 2 spaces, 4 spaces or Tab. Tick Sort keys A–Z if you want objects ordered alphabetically, which makes two versions easy to compare.
  3. Press Format for a pretty, indented result, Minify for the smallest single-line version, or Validate to check without changing anything.
  4. Take the output from Result with Copy result or Download .json.

Example: the classic trailing comma

This looks fine at a glance: an object with "name": "Ada", a list "langs": ["en", "tr",] and "active": true, written over five lines. Validate it and you get “Invalid JSON at line 3, column 24: comma before a closing bracket (trailing commas are not allowed)”. JavaScript accepts that comma, JSON does not. Another frequent one is {'a': 1}: the tool stops at line 1, column 2 and explains that keys and texts need double quotes.

What the validator reports

  • Unexpected characters, such as a stray letter or a missing colon.
  • Text that ends too early, usually a missing closing bracket or quote.
  • Problems inside strings: unescaped quotes, raw line breaks or bad backslash sequences.
  • Invalid numbers like 01, 1. or +5, and extra text after the JSON has finished.

The error messages come from the tool’s own parser, so they are identical in every browser rather than depending on each browser’s wording. Your JSON never leaves the page, which matters when it contains tokens, customer data or internal URLs.

Need to embed the JSON in a URL? Encode it with URL Encoder/Decoder. For binary data inside JSON, Base64 Encode/Decode converts it both ways.

Frequently asked questions

Does formatting change my data?

No. Only whitespace changes. With Sort keys A–Z, object keys are reordered, which does not change meaning in JSON but does change the text.

Why are comments rejected?

Standard JSON has no comments. Files that allow them, such as some editor settings, use extended formats like JSONC or JSON5.

How large a file can I format?

Several megabytes work well on a computer. Very large logs may be slow on phones.

Will big numbers lose precision?

Numbers beyond about 15–16 significant digits can be rounded by JavaScript when formatting. Keep very long IDs as strings.

Is my JSON uploaded?

No. Parsing and formatting run in your browser.