JSON Formatter & Validator
Paste JSON to pretty-print it, minify it, or check that it parses. Invalid input shows a clear error instead of breaking the page.
How to use
- Paste or type JSON into the input.
- Choose Format to indent, Minify to collapse whitespace, or Validate to check the text as-is.
- If parsing fails, use the line and column in the error to find the problem.
- Copy the formatted or minified result when you need it.
How it works
JSON.parse reads the text. If it succeeds, JSON.stringify can reprint the value with 2- or 4-space indent (pretty-print / beautify), or as a single line (minify). Validate leaves the text as you pasted it and reports that it parsed.
SyntaxError messages from the engine often include a character position; the page turns that into an approximate line and column. Very large pastes are rejected so formatting does not freeze the tab. Nothing is uploaded.
Formula
pretty = JSON.stringify(JSON.parse(text), null, indent) minify = JSON.stringify(JSON.parse(text)) validate = JSON.parse(text) succeeds
Worked examples
Object, pretty-print
{"name":"Ada","ok":true} → { "name": "Ada", "ok": true }
Array, minify
[ 1, 2, 3 ] → [1,2,3]
Invalid JSON
{"name": "Ada",} → Parse error near the trailing comma (line and column shown)
Useful notes
- Trailing commas and comments are not JSON and will fail validation.
- Input over 500,000 characters is rejected on purpose.
- The text stays in your browser. It is not sent to analytics.
FAQ
- Can I format and validate on the same page?
Yes. Use Format, Minify or Validate. Invalid JSON shows a parse error instead of a result.
- What does pretty-print mean?
The same JSON value reprinted with indentation and line breaks so a person can read it. Minify does the opposite.
- How do I tell if JSON is valid?
Use Validate. If JSON.parse succeeds, the text is valid JSON. A trailing comma or comment will fail.
- Is my JSON uploaded?
No. Parsing runs in your browser. The text is not sent to analytics.
- Why is there a size limit?
Huge documents can lock the tab while they parse and reprint. The limit keeps the page usable.
- Do you support JSON5 or comments?
No. Only standard JSON.
Guides
How to Format JSON
Formatting JSON means parsing it, then reprinting the same value with consistent indentation. Invalid text cannot be formatted — fix the syntax first.
How to Validate JSON
Valid JSON is text that JSON.parse accepts. Validation does not pretty-print or minify; it only reports whether the document is legal JSON.
JSON Pretty Print
Pretty-print reprints valid JSON with indentation so a person can read it. Minify reprints the same value as one line. Neither changes what the document means.
Related tools
Base64 Encoder / Decoder
Encode and decode Base64 in your browser with proper UTF-8 support, including Unicode and emoji.
URL Encoder / Decoder
Percent-encode or decode URL components in your browser with encodeURIComponent and decodeURIComponent.
Text Case Converter
Convert text to lowercase, UPPERCASE, Title Case, Sentence case, camelCase, PascalCase, snake_case or kebab-case.
Hash Generator
Hash text with SHA-256, SHA-384 or SHA-512 in your browser. Output is lowercase hex. Hashing is not encryption.
See all Utilities tools.