JSON Formatter — Pretty Print JSON with 2 or 4 Spaces or Tabs
Format messy single-line JSON with 2/4-space indentation and sorted keys.
- integer at $.requestId exceeds 2^53 (12345678901234567890): JavaScript JSON.parse rounds it
UTF-8 size: 340 B → 521 B (+53.2%)
When to use the JSON Formatter & Syntax Prettifier
Numbers and text left untouched
This formatter only changes spaces and line breaks. Numbers such as 1.50 or 12345678901234567890 and escapes such as \u00e9 are written exactly as in the source, not rounded or rewritten as JSON.parse followed by JSON.stringify would do.
Indentation to match your team
Pick 2 spaces, 4 spaces or a tab. The layout matches Python's json.dumps and JSON.stringify: one item per line, a space after each colon, and empty objects or arrays stay {} and [].
Sort keys for clean diffs
The sort option reorders every object recursively by code point, like Python's sort_keys, so two config files compare cleanly in Git or a diff tool.
Errors pointed out at once
When the JSON is broken, the formatter shows the line, column and a snippet with a ^ under the problem, such as a trailing comma or an unclosed quote.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing and formatting run in your browser, so API tokens or customer data inside the JSON never leave your device.
Why do my big numbers stay the same?
Because numbers are copied as text. JavaScript's JSON.parse rounds integers above 2^53, such as 19-digit transaction IDs, while this formatter does not.
Can it format JSON with comments?
No. Comments are not part of standard RFC 8259 JSON, so their position is flagged as an error. Remove them or keep the config as JSONC or YAML.
How large a JSON file can it format?
A few megabytes usually finish within seconds, depending on browser memory. The UTF-8 size before and after is shown under the buttons.
Similar tools
- JSON Minifier & Whitespace CompressorStrip whitespace and newlines from JSON payloads and compare byte savings.
- RFC 8259 JSON Syntax Validator & DebuggerPinpoint trailing commas, unquoted keys & syntax errors with line/column clues.
- Interactive Collapsible JSON Tree ViewerInspect nested JSON keys, data types and object counts cleanly in a collapsible tree.
- Semantic JSON Object Diff CheckerNormalize key order and spot added, removed or modified JSON paths clearly.