How to use the JSON formatter

  1. Paste your JSON into JSON input, or select Load example.
  2. Select Format (or press Ctrl+Enter) to pretty-print, or Minify to remove all whitespace.
  3. Choose 2 spaces, 4 spaces or tabs, and optionally sort property names alphabetically.
  4. Copy the result or download it as a .json file.

If the input isn't valid JSON, you'll see the line and column of the first problem and a plain-English explanation. Select Go to error to jump to it. For a full check, use the JSON validator.

Your data is never changed

Many online formatters run your JSON through JavaScript's JSON.parse, which silently alters data: 12345678901234567890 becomes 12345678901234567000, and 1.0 becomes 1. This formatter uses its own strict parser that keeps every number, string and escape sequence exactly as you wrote it, so only the whitespace changes. When Sort keys is on, the order of properties changes too; array order never does.

Format or minify?

Formatted JSON is indented and easy to read, which helps when debugging API responses, reviewing configuration files or writing documentation. Minified JSON has no unnecessary whitespace, which makes it smaller to store and send. Both represent exactly the same data.

Frequently asked questions

Is my JSON uploaded anywhere?

No. Formatting runs entirely in your browser, and your input is never sent to our servers or logged.

Can it fix invalid JSON?

It doesn't change your input automatically, because guessing what you meant could alter your data. Instead, it points to the exact problem, such as a trailing comma, single-quoted strings or a comment, and explains how to fix it.

Why is there a warning about duplicate keys?

JSON technically allows an object to repeat a property name, but most parsers then keep only the last value, so a duplicate is usually a mistake. The formatter keeps both, exactly as written, and warns you.

How large a file can it handle?

A file of a few megabytes typically formats in under a second on a modern computer. The practical limit is your browser's memory.