Two jobs in one page

The first job is validation. The page tells you whether your text follows JSON syntax, and rejects it with an error if it does not. The second job is formatting. A valid document is rewritten with line breaks and indentation of 0 to 8 spaces, so that a minified API response becomes readable, or a pretty-printed file becomes compact with an indent of 0. The default input {"a":1} with an indent of 2 returns true and a three-line document. Formatting only touches whitespace between tokens. The data inside is left alone, which makes the output safe to diff against the original.

What strict JSON allows

JSON is defined by RFC 8259 and ECMA-404. Keys and strings need double quotes, so single quotes are invalid. Trailing commas, comments, unquoted keys and values such as undefined, NaN and Infinity are not allowed. Numbers cannot have a leading plus sign or leading zeros, so 007 and +5 fail, but 0.5 and -3e2 are valid. Only true, false and null are valid literals, written in lowercase. These rules are why a configuration file that works in a JavaScript program may fail here. The page reports invalid syntax without trying to repair it, so you fix the exact spot yourself. A top-level value does not have to be an object: the text [1,2,3], the string "hello" and the number 42 are each valid documents. Whitespace between tokens may be spaces, tabs, line feeds and carriage returns only, and nothing else counts as a separator.

Keeping the original tokens

Many online formatters parse the text into objects and print it again, and that round trip changes the data. A number such as 12345678901234567890 becomes 12345678901234567000 when it passes through a double-precision float, and 1.0 turns into 1. This page works on the token stream instead, so number spellings, string escapes like \u00e9 and the order of keys are preserved. That matters for identifiers from databases and payment systems, which are often too large for a JavaScript number. Check that your own code parses such values with a BigInt-aware or string-based reader, because the formatted text is only as safe as the program that consumes it.

Choosing an indent

The indent is a whole number from 0 to 8. A value of 2 gives the compact style common in web projects, 4 matches many Python and Java conventions, and 0 removes all optional whitespace, producing a single line such as {"a":1,"b":[1,2]}. With an indent above 0, each object member and array element goes on its own line, one level deeper than its parent, and empty objects and arrays stay as {} and []. Minified output saves bytes in network transfers and configuration payloads, while indented output helps humans find a missing bracket. Pick based on who will read the text next. A pretty-printed file is also friendlier to version control, because a change to one value then shows up as one changed line instead of a rewrite of the whole line. The page will turn either form into the other without touching the data.

Duplicate keys

The JSON specification says object names should be unique, but it does not make duplicates a syntax error, and parsers behave differently. Many keep the last value, some keep the first, and some report an error. This page keeps every occurrence in its original place and does not reject them, so {"a":1,"a":2} stays as it is. Because downstream systems may interpret the document differently, treat duplicates as a data quality problem to fix at the source. A validator that says the syntax is valid is not saying that every consumer will read the same values from the text.

Syntax is not schema

A document can be valid JSON and still be wrong for its purpose. The page does not check that a field is a number, that a required key exists, or that a date has a particular format. JSON Schema is the usual tool for those rules, and it is not part of this page. A response of true under Valid means only that the text can be parsed. When debugging an API, validate the syntax here first, then compare the field names and types with the documentation, since mismatches in naming or type are the next most common cause of failures. A number sent as the string "42" and as the number 42 is valid either way, but many APIs accept only one, and a formatter that preserves the quotes lets you see which form you actually have.

Typical syntax errors

The most common problems are a trailing comma after the last element, a missing comma between members, single-quoted strings, and unescaped line breaks inside a string. Copying from a chat program often replaces straight quotes with curly ones, which are invalid. A byte order mark or stray characters before the opening brace also cause failures. Comments copied from a JSONC or JSON5 file are rejected. Since the page reports only that the syntax is invalid, narrow the problem by deleting half of the document and testing each part, or by checking the lines around the last place you edited.

Size and depth

Input is processed in your browser and limited to 1 MiB of UTF-8 text. Nesting deeper than 100 levels is rejected, which protects against pathological documents and matches the depth limits many parsers apply. Very large files are better handled by a command-line tool or an editor, which can stream the data. Because processing happens locally, nothing is uploaded by the page itself, but avoid pasting secrets such as API keys or personal records into any tool when a local alternative exists. Review documents from untrusted sources before using their contents.

Syntax checks without schema validation

The page checks syntax and reformats whitespace. It does not validate against a schema, sort keys, remove duplicates, convert to other formats, fix errors or evaluate the content. Output text depends on the tokens you supplied, and a top-level value of any JSON type, including a bare number or string, is acceptable. Because no values are rewritten, the formatted result stays as faithful to the input as the whitespace rules allow. Always confirm that the receiving system parses large numbers and repeated keys the way you expect.