JSON Formatter & Validator

Paste JSON to beautify it with clean indentation, minify it, sort its keys, or find exactly where a syntax error is.

🔒 Runs in your browser — your text is never uploaded.Shortcuts: / search · Ctrl/⌘ + Enter main button

How to use the JSON Formatter

  1. Paste your JSON.
  2. Choose an indentation size.
  3. Click Format, Minify or Sort keys.
  4. If there is an error, the line and column are shown.

Example

Input
{"name":"Ann","tags":["a","b"]}
Result
{
  "name": "Ann",
  "tags": [
    "a",
    "b"
  ]
}

What the JSON Formatter does

JSON is the most common format for data exchanged between web apps and APIs, but machine-generated JSON is often a single unreadable line. This tool turns it into something you can read and check.

  • Format: re-indents your JSON with 2 spaces, 4 spaces or tabs.
  • Minify: removes all whitespace to make the smallest possible output.
  • Sort keys: puts object keys in alphabetical order, which makes two files easier to compare.
  • Fix JSON: repairs common mistakes automatically, such as comments, single quotes, unquoted keys and trailing commas.
  • Tree view: switch from Code to Tree to collapse and expand objects and arrays.

Understanding error messages

When your JSON is not valid, the validator reports what it found and where, including the line and column. The most frequent causes are:

  • A trailing comma after the last item in an object or array.
  • Single quotes (') instead of double quotes (").
  • Keys that are not wrapped in double quotes.
  • Comments, which are not part of the JSON standard.
  • A missing comma between items or a missing closing bracket.

Try “Fix JSON” first. It handles the first four automatically. A missing bracket or comma needs to be corrected by hand, and the error position shows you where to look.

Common uses

  • Reading API responses copied from your browser’s network tab or a tool such as curl.
  • Checking configuration files before you deploy.
  • Preparing JSON for documentation by formatting it consistently.
  • Shrinking JSON with Minify before you embed it in code or a request.
  • Comparing two versions with the JSON Compare after sorting their keys.

Privacy

Your JSON never leaves your browser, so it is fine to paste responses that contain tokens, internal field names or customer data. Even so, avoid sharing real secrets in screenshots or links. Files up to 5 MB can be opened with “Open file”, and very large documents may feel slower depending on your device.

Frequently asked questions

Can it fix broken JSON?

Yes. Click “Fix JSON” to repair common mistakes automatically: comments, single quotes, unquoted keys, trailing commas and Python-style True/False/None. You can also switch the output to a collapsible tree view.

Is my JSON sent to a server?

No. Formatting and validation happen in your browser, so it is safe for API responses and config files.

Why is my JSON invalid?

Common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments. JSON does not allow any of these.

What is the difference between formatting and validating?

Validating checks that the JSON follows the standard. Formatting changes only its layout. This tool does both: it validates as you type and shows an error with the exact position if something is wrong.

Does Sort keys change my data?

It changes only the order of keys inside objects. Values and the order of items in arrays stay as they were.

Can I convert JSON to CSV?

Yes. Use the CSV to JSON Converter and switch it to JSON → CSV mode.

Learn more

More tools you may like