JSON Formatter & Validator
Pretty-print, minify and validate JSON with line-and-column error messages. Runs entirely in your browser.
How to use the JSON Formatter & Validator
- Paste your JSON into the input box, or press “Load example” to try a sample.
- Choose an indentation (2 spaces, 4 spaces or tab) and, if you want, sort keys alphabetically.
- Press Format to pretty-print, Minify to remove all whitespace, or Validate to check syntax only.
- If the JSON is invalid, the error shows the line and column to fix. Otherwise copy or download the result.
Good to know
- Validation uses the browser's built-in JSON.parse, so it follows strict RFC 8259 JSON: no comments, no trailing commas, no single quotes, no NaN or Infinity.
- Numbers are parsed as JavaScript numbers. Integers beyond 9,007,199,254,740,991 (2^53 − 1) lose precision when re-serialised, and duplicate object keys keep only the last value.
- Input is limited to 2,000,000 characters. Extremely deep nesting is reported as an error instead of freezing the page.
- Error positions come from your browser. Browsers that do not report a position (some versions of Safari) show the message without a line number.
Examples
- Pretty-print a compact payload
- {"id":7,"tags":["a","b"]} → formatted over several lines with your chosen indentation.
- Find a syntax error
- {"name": "Ada",} → Error with the line and column of the trailing comma, which standard JSON does not allow.
- Minify for transport
- A 4-space formatted object becomes one line with no spaces between tokens.
Frequently asked questions
Is my JSON uploaded anywhere?
No. Formatting and validation run in your browser with JSON.parse and JSON.stringify. The text is not sent to a server.
Why does my JSON with comments fail?
Standard JSON has no comment syntax. Formats such as JSONC or JSON5 allow comments, but they are not valid JSON, so this validator rejects them.
Does sorting keys change my data?
Sorting reorders object keys alphabetically at every level, which JSON treats as equivalent. Array order is never changed.
Related free tools
- Developer Tools
Base64 Encoder & Decoder
Encode and decode Base64 text with full Unicode support, URL-safe output and file-to-Base64 conversion.
Use tool - SEO & Marketing
Schema Markup Generator
Create JSON-LD structured data for Organization, LocalBusiness, Product, Article and FAQ pages from your own details.
Use tool - Text Tools
Text Diff Checker
Compare two texts side by side and see inserted and deleted lines and characters highlighted.
Use tool
Need Something Built For Your Business?
aimEncoders designs and builds custom software, websites and internal tools, backed by automated QA.
- Reply within 1 business day
- Fixed quote, no surprise invoices
- You own 100% of the code
Free discovery call • Straight to a developer • Strict NDA available