Skip to content

JSON Formatter

Paste JSON and get it formatted instantly, with syntax highlighting and the exact line and column of any error. Switch to minified output, sort keys, choose the indentation, then copy or download.

Runs in your browserFreeNo sign-up

Processed on your device. Files and text stay in your browser and are not uploaded to our servers. How privacy works

How to use the JSON Formatter

  1. Paste JSON into the input box (or click Paste to read your clipboard). The output updates as you type.
  2. Choose Format for readable, indented JSON or Minify for the smallest possible output.
  3. Optionally change the indentation to 4 spaces or tabs, and switch on Sort keys to order object keys alphabetically at every level.
  4. If the JSON is invalid, the message under the input tells you the line, column and likely fix; Jump to error puts the cursor there.
  5. Copy the result or download it as a .json file.

Features

  • Live formatting with syntax highlighting for keys, strings, numbers, booleans and null
  • Minify to a single line for configs, APIs and query parameters
  • Precise error reporting with line, column and hints for trailing commas, single quotes, comments and unquoted keys
  • 2-space, 4-space or tab indentation and optional key sorting
  • Keyboard shortcuts: Ctrl/Cmd+Enter to format, Ctrl/Cmd+Shift+M to minify
  • Handles multi-megabyte documents; highlighting steps aside for very large output to stay fast

What formatting does and doesn't change

Formatting only changes whitespace: indentation, line breaks and spaces after colons and commas. The values, key order (unless you enable sorting) and number representation stay as they were. Minifying removes all optional whitespace, which is what a JSON file looks like when produced by a server; it's byte-identical in meaning.

The formatter is a JavaScript program running in your browser. Nothing you paste is sent anywhere, which matters when the JSON is an API response containing tokens or customer data.

Common JSON mistakes the validator explains

Most invalid JSON is JavaScript that isn't quite JSON. The error messages recognise the usual suspects:

  • Trailing commas after the last item in an object or array
  • Single-quoted strings or unquoted keys
  • Comments (// or /* */), which JSON doesn't allow
  • undefined, NaN and Infinity, which have no JSON representation
  • Raw line breaks inside strings, and numbers with leading zeros such as 007

Frequently asked questions

Does the formatter change my numbers?

Numbers are parsed with JavaScript's number type, so integers beyond 2^53 and some long decimals may be rounded. If you need exact very large integers, keep them as strings in the source.

Why is key sorting off by default?

Key order carries meaning for some tools and readers. Sorting is useful for comparing documents or producing deterministic output, so it's an option rather than the default.

Is there a size limit?

No hard limit. Documents of several megabytes format in well under a second; above about 300 KB of output, syntax highlighting is skipped to keep typing responsive.

Is my JSON uploaded?

No. Parsing and formatting happen entirely in your browser.

Other tools people use alongside JSON Formatter.

In the news

You might also like

Something useful from another corner of VoltKit.