JSON formatter and validator
Pretty-print, minify, sort and validate JSON in your browser, with the line and column of the first syntax error. Nothing is uploaded.
What "valid JSON" means
JSON is stricter than JavaScript object literals. The things that most often make a document invalid: single quotes instead of double quotes, a trailing comma after the last item, comments, unquoted keys, undefined or NaN, and a leading byte-order mark pasted from a file. This tool uses the browser's own JSON.parse, so it accepts exactly what every browser and Node.js accept. When parsing fails, the message comes from your browser; Chrome and Firefox word it differently, and this page adds the line and column where it can work them out.
Sorting keys is useful for comparing two documents in a diff tool. It changes nothing about the meaning: JSON objects are unordered by definition, although in practice JavaScript keeps insertion order for string keys.
Read more in JSON explained.