Skip to content
OfflineWebTools
Tools

JSON Formatter

Format JSON with a configurable indent, minify it to a single line, or just validate the syntax. Sort object keys alphabetically, drop null values, and escape non-ASCII characters when you need pure ASCII output. Errors point at the exact line and column. Runs entirely in your browser.

Mode
Input

Input

Output

About the options

Indent. Choose 2, 4, or 8 spaces, a tab, or set a custom width (0–16). Minify mode ignores indent and produces the shortest valid JSON.

Sort keys. Recursively sorts object keys alphabetically at every level. Useful for diffing and for deterministic output in tests or version control.

Drop null values. Recursively removes keys whose value is null from objects. Arrays keep their length and order; null array elements are also dropped.

Escape non-ASCII. Encodes any character above U+007F as \uXXXX (with surrogate pairs for code points above U+FFFF), and escapes common control characters. Useful when you need pure-ASCII JSON.

Validate. Parses the input but does not transform it. On success it prints a confirmation. On failure it shows the error message, an excerpt of the offending line, and the byte position so you can locate the problem.

Color syntax. When enabled, the output is rendered with distinct colors for keys, strings, numbers, booleans, and null so structure is easier to scan. Toggle is off by default.

Related search terms

Related terms