JSON Formatter & Validator
Pretty-print, minify, and validate JSON.
🔒 Parsing happens entirely in your browser.
About this tool
Uses the browser's native JSON.parse and JSON.stringify. Errors point to the byte offset reported by the parser, which usually pinpoints the bad character.
Frequently asked
▸Why not just use JSON.stringify(x, null, 2) in DevTools?
You can, but only when you already have the value in a JS context. The formatter accepts pasted text — including JSON pulled out of logs or curl responses — and validates it as it formats, surfacing parse errors with positions.
▸What indent should I pick?
2 spaces matches Prettier and most config files. 4 spaces matches the Python convention. Tab is best when the file ships to mixed environments. Whatever you pick, stick with it across a project.
▸Does it sort keys or otherwise rewrite the structure?
No. The formatter only normalizes whitespace. Keys stay in their original order, numbers stay in their original form, and strings are preserved byte-for-byte.
You might also like
- XML Formatter & ValidatorPretty-print or minify XML and validate that it's well-formed.
- JSONPath TesterQuery JSON with JSONPath expressions and see the results live.
- ANSI Escape StripperRemove ANSI color codes and terminal control sequences from CI logs or terminal captures.
- Comment Style ConverterTranslate //, #, --, ;, %, /* */, and <!-- --> comments between languages while preserving indentation.
Used in these workflows
- CSV to Pretty JSONParse CSV with a header row and pretty-print as JSON.
- JSON to YAMLValidate JSON, then convert it to YAML.
- Decode JWTDecode a JWT and pretty-print the result.
- URL InspectorBreak a URL into protocol, host, path, query params, and hash.
- Node Stack Trace → JSONParse a V8 stack trace into structured JSON frames, then pretty-print.
- Python Traceback → JSONParse a Python traceback (including chained exception blocks) into structured JSON.
- User-Agent → JSONParse a User-Agent string into browser / OS / device / engine fields.