JSON Formatter and Validator
Paste JSON to format and validate it as you type. If something's wrong, you'll see the line, the column and what to fix.
Add this calculator to your website
Copy the code and paste it into your page's HTML. It's free; please keep the credit link.
JSON rules that trip people up
- Strings and keys use double quotes: "name", never 'name' or name.
- No comma after the last item in an object or array.
- No comments, no undefined, NaN or Infinity.
- Line breaks and tabs inside strings must be escaped as \n and \t.
- Numbers have no leading zeros (007) or leading + sign, and no trailing dot (1.).
Pretty or minified?
Indented JSON is easier to read and diff, which is why config files and API docs use it. Minified JSON drops every unneeded space and is what you send over the network; with gzip the difference shrinks, but minifying still saves bytes. Sorting keys makes two versions of the same object easy to compare line by line.
Frequently asked questions
Why is my JSON invalid?
The usual culprits are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, comments, and line breaks inside strings. JavaScript allows all of these, JSON (RFC 8259) doesn't.
Does formatting change my data?
No, only whitespace and, if you choose, the order of keys. The one exception is integers beyond 9,007,199,254,740,991: JavaScript can't hold them exactly, and the tool warns you when it sees one.
Can it handle large files?
Yes, several megabytes paste fine. The work happens on your device, so very large inputs depend on your computer's memory.
Is what I paste sent to a server?
No. This tool runs entirely in your browser with JavaScript and the built-in Web Crypto API. Nothing you type, paste or open is uploaded or stored.