convertCASEpro

MODE

JSON Formatter and Minifier

Paste JSON to validate it and print it neatly, or compress it to a single line.

INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0

How the JSON Formatter and Minifier works

The input is parsed with the same strict parser used by browsers and JavaScript runtimes, so a pass here means other tools will accept the JSON too. Beautify mode indents with two spaces, four spaces or tabs. Minify mode removes every optional space and line break.

When the JSON is invalid, the tool reports the problem with its line and column, such as an unexpected token or a missing comma. Sorting keys alphabetically at every level makes it easy to compare two documents or keep files diff friendly.

When it is useful

  • •Making an API response readable.
  • •Finding the missing comma or stray quote in a config file.
  • •Minifying JSON before embedding it in a request or a script.
  • •Normalizing key order before comparing two JSON files.

Frequently Asked Questions

Why is my JSON invalid when it looks fine?

Common causes are trailing commas, single quotes around strings, unquoted keys and comments. JSON is stricter than JavaScript object syntax.

Does sorting keys change the meaning?

No. JSON objects are unordered. Array order is never changed.

How large a file can it handle?

Files of several megabytes work fine on a modern computer, since everything is processed locally.

Related tools

[ Browse all tools ]