JSON formatter and validator
Paste your JSON: it is checked as you type, with the line and column of the first error. Format it to read it, minify it to send it, sort its keys, or encode text as a JSON string and back.
🔒 Everything happens in your browser: the text is never sent to our servers.
Formatting
JSON string
Encode turns text into a JSON string (quotes, \n, \" escaped); decode does the opposite.
Reading and fixing JSON
JSON basics
A JSON document contains objects in braces, arrays in brackets, strings in double quotes, numbers, true, false and null. Keys are always double-quoted strings. Comments, single quotes and a comma after the last item, accepted in JavaScript, are not allowed in JSON.
Finding the error quickly
The tool shows the line and column where parsing fails, with an excerpt and a marker under the offending character. The mistake is at that spot or just before: a missing comma between two items, an unclosed brace, a forgotten quote. Format a minified JSON first so that the line number is meaningful.
Comparing two API responses
Sort the keys, then format with the same indentation: two documents holding the same data become identical line by line, whatever the original key order. You can then compare them with any diff tool.
Encoding and decoding a string
To put text inside JSON (a multi-line message, HTML, a Windows path), quotes, backslashes and line breaks must be escaped: that is what “Encode as string” does. Conversely, “Decode string” gets the original text back from a value such as "Hello\nworld".
Frequently asked questions
Why is my JSON invalid?
The most common mistakes: a comma after the last item, single quotes instead of double quotes, unquoted keys, a comment, or an unescaped quote inside a string. The tool shows the line and column where parsing stops.
Is my data sent to a server?
No. Validation and formatting happen in your browser: you can paste API responses or configuration files without them leaving your computer.
What is the difference between formatting and minifying?
Formatting adds indentation and line breaks for easy reading and comparison. Minifying removes them to reduce size, useful for network transfer or storage. The data stays identical.
Why does a large number change after formatting?
JavaScript stores numbers with limited precision: an integer above 9,007,199,254,740,991 gets rounded. The tool warns you. To keep such identifiers intact, send them as strings.
Does JSON allow comments?
No, the JSON standard has no comments. Some derived formats (JSONC, JSON5) accept them, notably in editor configuration files, but a standard JSON parser rejects them.