Start a project

Tool 35 of 57 · Code

JSON Formatter & Validator

Paste JSON to format it, minify it or sort its keys, and if it's broken, see the exact line and column with a hint about what's wrong.

JSON Formatter & Validator at a glanceIllustration: 1, Messy JSON; 2, processed in your browser; 3, Formatted or minified.JSON Formatter & Validator{ }1Messy JSON</>3Formatted or minified2In yourbrowser
1 Messy JSON 2 processed on your device 3 Formatted or minified

JSON Formatter & Validator

Your JSON

Result

Formatted JSON

01

What it does

Pretty-prints, minifies and validates JSON, pointing to the exact line and column of any error.

  • 2 or 4 spaces, tabs or minified
  • Errors with line, column and a plain-English hint
  • Jump to the error in the input
  • Sort keys A to Z

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

Formatted or minified JSON, with a Copy and a Download button on every result.

  • JSON
  • Validator
  • Minify

Why it matters

JSON is everywhere in web work: API responses, config files, structured data and package files. One missing comma or a trailing comma breaks the lot, and the error messages browsers give are often cryptic.

Many online formatters send what you paste to a server, which is a problem for API keys and customer data. This one runs in your browser and explains errors in plain English.

How it works

  1. InputJSON from an API or a file
  2. In your browserParsed and checked by the browser
  3. OutputFormatted or minified JSON, or the exact error line

Where it fits in a designer's workflow

  1. Plan
  2. Design
  3. Build
  4. Test
  5. Launch
Debugging API responses and config files.

By the numbers

The sample JSON minified and indentedMinified: 145 bytes; 2-space indent: 198 bytes; 4-space indent: 230 bytes; Tab indent: 182 bytesMinified145 bytes2-space indent198 bytes4-space indent230 bytesTab indent182 bytes
Measured from this tool's sample. Indenting is for people; minified JSON is smaller to send, though gzip narrows the gap (139 vs 158 bytes gzipped). Source: RFC 8259: JSON.
Show the numbers as a table
StyleBytes
Minified145
2-space indent198
4-space indent230
Tab indent182

How to use it

  1. Paste JSON into the box.
  2. Choose an indent, or minify.
  3. If there's an error, read the hint and press Jump to the error.
  4. Copy or download the result.

FAQ

Why is my JSON invalid?

The usual causes are a trailing comma, single quotes instead of double quotes, keys without quotes, or comments. JSON allows none of them.

Is my data sent anywhere?

No. It's parsed by your browser's own JSON parser on this page.

Does sorting keys change the data?

No. Object keys have no meaning in their order. Arrays keep their order.

Can it handle big files?

Yes, several megabytes are fine. Very large files may take a second to format.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk