JSON formatter and validator

Format, minify and validate JSON in your browser, with the line and column of any error.

Everything happens on your device. What you type never leaves it.

Indent

This tool needs JavaScript to run

About this tool

This tool formats, minifies and validates JSON. Paste or type JSON on the left and the result appears on the right as you type. Format adds indentation so the structure is easy to read; Minify removes every space and line break that is not inside a string, so the text is as short as it can be.

If the JSON is not valid, you are told what is wrong in plain language, with the line and column where it goes wrong, so you can fix it without hunting. Strings and numbers are kept exactly as you wrote them: a long number is never rounded and an escape such as \u00e9 is never rewritten.

Everything happens on your device. What you paste is never sent to a server, so it is safe to use with tokens, configuration and customer data. After your first visit the tool also works with no connection.

Examples

Format compact JSON

Input

{"name":"ajx.io","tools":12,"tags":["json","private"]}

Output

{
  "name": "ajx.io",
  "tools": 12,
  "tags": [
    "json",
    "private"
  ]
}

Minify formatted JSON

Input

{
  "id": 7,
  "active": true,
  "notes": null
}

Output

{"id":7,"active":true,"notes":null}

Find a mistake

Input

{
  "id": 7,
}

Output

Unexpected comma at line 2, column 10. Remove it or add another value.

Common questions

Is the JSON I paste uploaded anywhere?

No. The JSON is read and written by code running in your browser. Nothing is sent to ajx.io or to anyone else, and the tool keeps working if you go offline.

What is the difference between Format and Minify?

Format indents the JSON with 2 spaces, 4 spaces or a tab so a person can read it. Minify removes all the whitespace outside strings so it is as small as possible, which is useful for requests and configuration files.

Does it change my numbers or strings?

No. Numbers and strings are copied exactly as written, so a number with more digits than a program can hold, such as 12345678901234567890, keeps every digit and an escape such as \u00e9 stays as it is.

Why does it say there is an unexpected comma?

JSON does not allow a comma after the last item in an object or array. The message gives the line and column of the comma. Remove it, or add the value that should follow it.

What happens if a key appears twice?

Repeating a key is still valid JSON, so the document is accepted and both entries are kept. The tool tells you which key is repeated and where, because most programs keep only the last value.