Free JSON Formatter and Validator
This free JSON formatter validates any JSON text, pretty prints it with the indentation you choose or minifies it to one line, and sorts keys if you want them in order. When the JSON is broken it shows the line and column of the error and the likely cause, such as a trailing comma. It suits developers checking API responses and marketers editing schema markup.

JSON Formatter and Validator
Generators and Converters
About this tool
JSON is strict: keys must be in double quotes, strings must use double quotes, there is no trailing comma after the last item, and comments are not allowed. Most "invalid JSON" errors come from those four rules, usually after hand-editing a config file or copying from JavaScript. The validator here parses the text with the same rules every browser and API uses and, instead of only saying "syntax error", works out the line and column and shows the characters around that point with a plain-language explanation.
Pretty printing adds line breaks and indentation so nested objects are readable; minifying removes every unnecessary byte for a payload or an inline script. Sorting keys alphabetically makes two files easy to compare. Unicode is kept as it is and slashes are not escaped, so the output stays readable. Large numbers and decimals are preserved exactly as written rather than rounded through floating point.
The structure summary counts objects, arrays, strings, numbers, booleans and nulls, reports the deepest nesting level and lists the top-level keys, which is a quick way to check that an API response or a schema block contains what you expect. Input is limited to 500 KB and nothing you paste is stored.
Frequently asked questions
Why is my JSON invalid when it works in JavaScript?
JavaScript object literals are more relaxed than JSON. JavaScript allows single quotes, unquoted keys, trailing commas, comments and values such as undefined or NaN; JSON allows none of them. The most common fix is replacing single quotes with double quotes and removing the comma after the last item in each object and array. The error position shown here points at the first place the rules are broken.
Should I minify the JSON-LD schema on my web pages?
It makes no difference to Google, which reads both forms, and the saving is a few hundred bytes. Keep schema readable during development so mistakes are easy to spot, and minify it only if your page builder or CDN does not already compress the HTML. Validate it here first, then test it with Google's Rich Results Test.
Does the formatter change my numbers or Unicode text?
No. Numbers are kept exactly as written, including long IDs and decimals that would lose precision as floating point, and Unicode characters such as Hindi or emoji are kept as characters rather than turned into \u escapes. Escaped sequences in the input are kept as they are in the output.
Can I validate JSON with comments or a JSON5 file?
Not as they are. Comments, single quotes and trailing commas are not valid JSON, so a config file written in JSON5 or JSONC will be reported as invalid at the first comment. Strip the comments first, or use the error position to find them one by one. Package.json and most API payloads are plain JSON and validate as expected.
