Skip to content

JSON Formatter

Format, validate and minify JSON, with the exact line and column of any error explained in plain words.

Nothing you enter leaves your device. Everything runs in your browser.

How to use it

  1. Paste into "Your JSON" or press "Open a .json file".
  2. Choose the "Indent" and tick "Sort keys A–Z" if you want keys in order.
  3. Press "Format" to pretty-print or "Minify" to remove all spaces.
  4. If there is an error, read the line and column, then press "Show me in the box"; otherwise use "Copy result" or "Download .json".

Examples

Trailing comma
Input
{"a":1,}
Output
Line 1, column 7: Trailing comma. Remove the comma before the closing } or ].
Pretty-print
Input
{"a":1,"b":[true,null]}
Output
{ "a": 1, "b": [ true, null ] }
Minify
Input
{ "a" : [ 1 , 2 ] }
Output
{"a":[1,2]}

Errors in plain words

Most JSON errors come from habits carried over from JavaScript or Python. Instead of a vague “unexpected token”, this formatter names the problem and points to it:

  • Trailing comma after the last item, as in [1, 2,].
  • Single quotes such as 'name'. JSON only allows double quotes.
  • Keys without quotes, as in {name: "Ali"}.
  • Comments with // or /* */, which JSON does not allow.
  • Missing commas between values, or a missing colon after a key.
  • Bad numbers such as 01, +5 or .5.
  • Raw line breaks or tabs inside a string, which must be written as n and t.

Lines and columns are counted from 1, the same way code editors count them, so you can jump to the same spot in VS Code or Notepad++.

Large numbers are kept exactly

Many online formatters run your text through the browser’s own JSON reader, which silently changes very large numbers: an ID such as 12345678901234567890 comes back as 12345678901234567000. This tool reads the JSON itself and writes numbers back exactly as you gave them, including trailing zeros such as 1.50.

Format, minify and sort

Formatting adds line breaks and indentation with 2 spaces, 4 spaces or tabs, so nested data is easy to read. Minifying removes every space and line break that JSON does not need, which makes files smaller for APIs and config. Sorting keys puts object keys in A to Z order at every level, which makes two versions of a file easier to compare. Arrays keep their order.

Private and fast

Your JSON never leaves your browser, so it is safe for API responses with tokens or customer data. Files up to 5 MB are accepted; anything over 100 KB is processed in a background worker, so the page stays responsive while it works.

Frequently asked questions

How do I check if my JSON is valid?

Paste it and press "Format". Valid JSON is formatted and you see a count of objects, arrays and values; invalid JSON shows the exact line, column and reason.

Why does JSON not allow comments or trailing commas?

The JSON standard was kept deliberately small so every language reads it the same way. Formats such as JSON5 and JSONC allow them, but standard JSON readers will reject them.

Will formatting change my numbers?

No. Numbers are written back exactly as typed, so long IDs and values such as 1.50 stay the same.

What is the difference between Format and Minify?

Format adds indentation and line breaks to make JSON readable. Minify removes them to make the file as small as possible.

How large a file can I open?

Up to 5 MB. Large files are processed in the background so the page does not freeze.

Is my data uploaded?

No. Everything happens in your browser, which makes it safe for private API responses.

Guides

See all Developer

Can’t find the tool you need?

Tell us what you’re looking for. We add new tools every month, and the most requested ones come first.

Request a tool