Skip to content
JustTools

JSON Formatter & Validator

Paste JSON to beautify, validate or minify it instantly. Errors point to the exact line and column, common mistakes can be fixed in one click, and nothing leaves your browser.

Runs in your browser Free · no sign-up

At a glance

  • Formats JSON with 2 spaces, 4 spaces or tabs, or minifies it to a single line.
  • Validates strictly against the JSON standard (RFC 8259) and reports each error with its line and column, highlighting the exact spot.
  • Fix mistakes mode repairs comments, trailing commas, single quotes, unquoted keys and Python-style True/False/None.
  • Keeps numbers exactly as written: large integers such as 12345678901234567890 are not rounded, unlike JavaScript’s JSON.parse.
  • Preserves key order and warns about duplicate keys; can sort keys alphabetically at every level.
  • Includes a collapsible tree view for exploring large or deeply nested JSON.
  • Runs entirely in your browser: pasted JSON — API responses, tokens, configs — is never uploaded or saved.

Step by step

How to format and validate JSON

  1. 1

    Paste your JSON

    Paste into the Input box, click Open file to load a .json file, or try the Sample.

  2. 2

    Read the result

    Valid JSON is formatted instantly on the right. If it is invalid, the error bar shows the line, column and reason.

  3. 3

    Fix any errors

    Click Show in input to jump to the problem, or Fix automatically to repair comments, trailing commas and quotes.

  4. 4

    Copy or download

    Pick 2 spaces, 4 spaces, tabs or Minify, optionally sort keys, then copy the output or download it as a .json file.

Features

Everything you need, nothing you don’t

Precise error messages

Instead of “Unexpected token”, you get a plain-English message such as “Expected ',' or '}' after property value” with the line, column and a pointer to the character.

One-click repair

JSON copied from JavaScript, config files or Python often has comments, trailing commas or single quotes. Fix mistakes converts it to valid JSON and lists every change.

Exact numbers

IDs, prices and big integers are kept character-for-character, so formatting never silently changes your data.

Tree view

Expand and collapse objects and arrays to explore large responses, with item counts at every level.

Beautify or minify

Choose 2 spaces, 4 spaces or tabs for readability, or minify to remove every unnecessary byte before shipping.

Private by design

Nothing is sent to a server and nothing is stored, so it is safe for API keys, tokens and customer data.

The most common JSON errors — and how to fix them

JSON is stricter than JavaScript. These mistakes cause almost every “invalid JSON” error. All of them except missing commas, missing brackets and leading zeros can be repaired automatically with Fix mistakes.

ErrorInvalidValid
Trailing comma{"a": 1,}{"a": 1}
Single quotes{'a': 'b'}{"a": "b"}
Unquoted key{a: 1}{"a": 1}
Comments{"a": 1 // note}{"a": 1}
Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}
Python literals{"ok": True, "x": None}{"ok": true, "x": null}
Leading zero{"n": 007}{"n": 7}
Raw line break in a string"line one ↵ line two""line one\nline two"

Why numbers stay exact here

JavaScript stores every number as a 64-bit float, so JSON.parse silently rounds integers above 9,007,199,254,740,991: 12345678901234567890 becomes 12345678901234567000. That corrupts order IDs, tweet IDs and account numbers. This formatter keeps each number’s original text, so the output is exactly what you pasted — only the whitespace changes.

Pretty-printed vs minified JSON

  • Pretty-printed (2 or 4 spaces, or tabs) is for people: logs, config files, code reviews and documentation.
  • Minified removes all optional whitespace and is for machines: API payloads, local storage and anything sent over the network. For typical JSON it is 10–30% smaller than 2-space formatting, before gzip.
  • Sorted keys make two JSON documents easy to compare in a diff, because the same keys always appear in the same order.

JSON syntax in 60 seconds

  • Values are strings, numbers, true, false, null, objects {} or arrays [].
  • Strings and keys use double quotes only. Escape " as \" and a backslash as \\.
  • Items are separated by commas, with no comma after the last one.
  • Numbers have no leading zeros, no + sign, and no NaN or Infinity.
  • Comments are not part of JSON. Use JSONC or JSON5 files if you need them, and strip comments before parsing.

FAQ

Frequently asked questions

Is it safe to paste API responses or tokens here?

Yes. The formatter runs entirely in your browser; your JSON is never sent to a server, logged or saved. Close the tab and it is gone.

How do I find where my JSON is broken?

The red error bar gives the line and column and shows the line with a ^ under the problem. Click Show in input to jump straight to it.

What does “Fix mistakes” change?

It removes comments and trailing commas, converts single-quoted strings, quotes bare property names and turns Python’s True, False and None into true, false and null. Everything it changed is listed, and you can replace your input with the fixed JSON.

Why does my number look different in other tools?

Most online formatters use JavaScript’s JSON.parse, which rounds integers larger than 2^53. This tool keeps numbers exactly as written, so large IDs stay correct.

Can it handle large JSON files?

Yes — multi-megabyte files work, limited only by your device’s memory. Syntax colouring switches off above about 200 KB of output to keep the page fast.

Does it support JSON5 or JSONC?

Turn on Fix mistakes to read the most common JSON5/JSONC features — comments, trailing commas, single quotes and unquoted keys — and convert them into standard JSON.

What happens with duplicate keys?

The JSON standard leaves duplicates undefined; most parsers keep the last value. This tool does the same and shows a warning with the line of each duplicate, so you can fix the source.

Can I download the result?

Yes. Click Download to save the output as formatted.json or minified.json, or Copy to put it on your clipboard.

Keep going

Browse every tool

Last updated Report a problem or suggest a feature