Paste JSON to check that it is valid and to reformat it. Format mode indents it with a tab or 2, 4 or 8 spaces; Minify mode removes all whitespace and puts it on one line. The input is checked with the same strict rules as JavaScript's JSON.parse, and when it fails, the error message shows what went wrong.
- Does it validate my JSON?
- Yes. The input is parsed with the browser's JSON.parse. If parsing fails, the browser's error message is shown (in most browsers it includes the position of the problem) and the copy button stays disabled until the JSON is valid.
- Which mistakes are most common?
- A trailing comma after the last item, keys without double quotes, strings in single quotes, comments, and values such as undefined, NaN or Infinity. All of these are allowed in JavaScript but not in JSON, so they are reported as errors.
- Can I minify as well as beautify?
- Yes. Minify removes every space and line break outside strings and puts the JSON on one line, which is handy for environment variables, query parameters or log entries. The output character count shows how much smaller it got.
- Which indent sizes are available?
- Tab, 2 spaces, 4 spaces or 8 spaces. The indent option is only shown in Format mode.
- Does formatting change my data?
- The values stay the same, but the output is rebuilt from the parsed data. Key order is kept, except that keys that look like non-negative integers (such as "1" or "20") move to the front. Numbers are written in their shortest form (1.0 becomes 1), escapes such as \u3042 become the character itself, and if a key appears twice only the last value remains.
- Are large numbers kept exactly?
- Not always. Numbers are read as JavaScript numbers, so integers larger than 9007199254740991, such as some 64-bit IDs, can lose precision. Keep such IDs as strings in your JSON.
- Is my JSON uploaded anywhere?
- No. Formatting happens in your browser. The input, mode and indent are also kept in the page URL (when the input is under about 8,000 characters once URL-encoded), so reloading keeps your JSON. If you share that URL, the JSON goes with it.
- What is it useful for?
- Reading minified API responses and log lines, finding the syntax error in a config file before deploying, and compacting JSON before pasting it into a single-line field.