JSON formatter

    Prettify, minify and validate JSON, with optional key sorting.

    Loading tool…

    About the json formatter

    Validates JSON and reformats it with two spaces, four spaces or tabs, or strips it down to a single minified line. Keys can be sorted recursively, which makes two config files directly comparable. Parse errors report what the parser objected to.

    Frequently asked questions

    Why does my JSON fail to parse?

    Nearly always a trailing comma, a single quote where a double is required, or an unquoted key. All three are legal in JavaScript object literals but forbidden in JSON.

    Does sorting keys change the meaning?

    No. JSON objects are unordered by specification, so sorting is safe and makes diffs far quieter. Array order is never touched, because that is significant.

    Often used alongside