All processing happens locally in your browser — nothing is sent to any server
JSON Input
Indent
JSON Output

JSON Formatter is a free online tool that formats, validates, and minifies JSON data instantly in your browser. Supports JSON5, configurable indentation, and key sorting. No data is sent to any server.

What is JSON Formatting?

JSON (JavaScript Object Notation) is the universal data interchange format of the web. APIs return it, config files use it, and every modern programming language can parse it. Pair it with the YAML converter or CSV converter for cross-format workflows. Formatting (pretty-printing) takes minified, hard-to-read JSON and adds indentation and line breaks so humans can scan and understand the structure at a glance.

Compression (minification) does the reverse: it strips all unnecessary whitespace, producing the smallest possible valid JSON for production use — smaller payloads mean faster network transfers and lower bandwidth costs.

This tool runs entirely in your browser. No data is ever sent to any server.

What is JSON5?

JSON5 is a superset of JSON that adds human-friendly features: comments (// and /* */), trailing commas, single-quoted strings, unquoted object keys, hexadecimal numbers (0xFF), and special values like NaN and Infinity. It was created to make JSON easier to write by hand — especially for configuration files.

Enable JSON5 mode to parse relaxed input directly. When JSON5 mode is off, Format and Compress automatically fall back to JSON5 parsing if strict JSON parsing fails — you'll see a notification when this happens. Output is always standard JSON.

Common Use Cases

Formatting API responses: paste a raw API response and pretty-print it to understand the data structure.

Minifying config files: compress JSON before deploying to production to reduce file size. Use Text Diff to verify the minified output matches the original.

Fixing hand-edited JSON: paste JSON with trailing commas or comments, toggle JSON5 mode, and get clean standard JSON output.

Sorting object keys: alphabetically sort keys for consistent diff output when version-controlling JSON files.

Limitations

Very large JSON files (>10MB) may cause the browser to pause briefly during formatting.

Numbers beyond JavaScript's safe integer range (±2⁵³) may lose precision after round-tripping through JSON.parse/stringify.

JSON5 error messages may not include exact line and column numbers.

Related Tools