Paste a payload into this JSON formatter and validator and you get three things straight away: a syntax verdict, readable indentation, and compact output. All three are computed in your browser by the platform's own JSON parser. Formatting and validation are pure built-in operations, so JSON.parse() and JSON.stringify() return a result without a service round trip (MDN: JSON, MDN: JSON.parse()). There is no upload and no account; a token-bearing payload does not have to travel anywhere for the tool to do its job.
That design matters as payloads grow sensitive. API responses carry session state and JWTs embed bearer material, so "never leaves your device" is a real property of parsing text locally rather than shipping it to a server. That claim is scoped to the pasted payload. Loading the page itself still makes ordinary network requests: it fetches its stylesheet, script bundles and cover image, and the live page includes Google Tag Manager in a consent-denied-by-default mode. No payload-carrying call shows up in the page's static HTML, but the minified JavaScript bundle was not analysed for this refresh. The honest claim is about what the parsing step does with your text, not a promise about every request the page makes.
Key Takeaways
- Formatting and validation run in your browser; the pasted payload stays on your device.
- Valid JSON follows RFC 8259: double quotes, no comments, no trailing commas.
- Syntax validity is not schema conformance; use the JSON Schema validator for shape.
- A whole
.jsonlfile is a stream of values, not one JSON document.- Integers above 9,007,199,254,740,991 lose precision, so send large IDs as strings.
What counts as valid JSON
Two aligned standards define the grammar: RFC 8259, the IETF Internet Standard published in December 2017, and ECMA-404 second edition, released the same month and listed by Ecma under the equivalent ISO/IEC number 21778 (ECMA-404). RFC 8259 names ECMA-404 as a normative reference precisely to confirm that the two grammars agree, despite different wording (RFC 8259). They are not competing definitions.
A JSON document may contain only six structural characters ({ } [ ] : ,), strings in double quotation marks, numbers, and the three literal names true, false, and null. Keys must be double-quoted strings, single quotes are illegal, and the grammar has no comment syntax (RFC 8259). The practical consequence: a config file with comments or trailing commas is not valid JSON, whatever an editor may claim. Extensions exist, but a validator reports what every downstream parser will accept.
Why 'unexpected token at position N' is vague
Vagueness is a side effect of speed. Single-pass parsers read left to right and stop at the first byte that cannot extend a valid token, so the reported offset often lands after the real mistake. A missing comma on one line produces an error pointing at the next line's opening quote.
Engine wording differs too. Classic V8 reported Unexpected token a in JSON at position 12, SpiderMonkey gives a line and column, and JavaScriptCore says Unexpected EOF. Recent Chrome and Node builds add a snippet of the offending input, yet the same broken document still yields different messages per browser. JSON.parse() throws SyntaxError on text that breaks the grammar (MDN: JSON.parse()). Messages say where parsing stopped, not what broke, so the sections below map the usual suspects.
Why encoding problems show up at position 0
Position 0 usually means the bytes are wrong before syntax gets a vote. RFC 8259 requires JSON exchanged between systems outside a closed ecosystem to be encoded in UTF-8, and says implementations must not add a byte order mark (U+FEFF) to a networked JSON text, though parsers may ignore one (RFC 8259, section 8.1). A BOM at the start of a file reads as character code 65279, which the grammar rejects, and UTF-16 encoded files trigger the same confusion. Empty responses fail identically.
HTML error pages cause the rest: a gateway returns markup with a 200 status and the parser dies on the first angle bracket. The registered application/json media type has no charset parameter, because adding one has no effect on a compliant recipient (RFC 8259, section 11). Before hunting syntax bugs, strip any BOM, confirm UTF-8, and log the raw response body.
Valid JSON is not the same as a valid JSON Schema
Here is the distinction this page exists to make clear. The official JSON Schema documentation shows two records describing the same person and states that both are equally valid JSON; one then fails a schema fragment while the other passes (JSON Schema: What is a schema?). Passing a syntax check therefore says nothing about whether a document matches the shape an API expects.
A schema is written in JSON, but it is data rather than a program. JSON Schema describes itself as a declarative format for describing the structure of other data, and that declarative nature sets limits on cross-field constraints, which is why complex formats need a second, semantic validation phase (JSON Schema). This page checks the syntax of one document. For conformance, use the tool that will check the document against a JSON Schema. They answer different questions, and being more thorough at syntax checking does not turn one into the other. A schema that is itself written in valid JSON is not thereby a correct schema.
JSON is not JavaScript
JSON grew out of JavaScript syntax but is distinct from it. MDN puts it plainly: most of JavaScript is not JSON (MDN: JSON). Property names need double quotes, trailing commas are forbidden, leading zeros are not allowed, and there are no comments, no undefined, and no NaN or Infinity. RFC 8259 adds that JSON is a subset of JavaScript excluding assignment and invocation, and calls parsing JSON with eval() an unacceptable security risk because U+2028 and U+2029 are legal in JSON yet broke pre-ES2019 JavaScript string literals (RFC 8259, section 12). A real parser handles both cases, and this tool uses one.
A whole JSON Lines file is not one JSON document
JSON Lines is a stream format with three rules: UTF-8 encoding, one valid JSON value per line, and a \n line terminator (\r\n is also accepted). Any JSON value is allowed on a line, but a blank line is not, and a byte order mark must not be included (JSON Lines specification). Files use the .jsonl extension. The application/jsonl MIME type is explicitly not yet standardized, so do not treat it as a registered type.
Paste an entire .jsonl file into a single-document validator and it will fail by design: the parser expects one value and meets several. Paste one line at a time, or convert the stream first. That is a limit of the format, not a bug in the checker.
Duplicate keys pass syntax checks but are not interoperable
Grammatically, duplicate keys are allowed, which surprises experienced developers. RFC 8259 says the names within an object SHOULD be unique, then warns that software receiving duplicates behaves unpredictably: implementations keep the last pair, report an error, or return all pairs (RFC 8259, section 4). That is a recommendation, not an invalidity rule, so {"a": 1, "a": 2} passes a syntax check.
The silence hides risk. A staging parser might keep the last value while production keeps the first, and both act within the spec. Treat repeated keys as a review finding before trusting a merged config, rather than expecting the validator to reject them.
Large IDs lose precision before you can inspect them
JavaScript stores numbers as IEEE 754 binary64 values, exact for integers only up to 9,007,199,254,740,991, which is 2^53 minus 1. RFC 8259 calls that range what interoperable implementations agree on (RFC 8259, section 6). Parse a 20-digit identifier such as 12345678901234567890 and it returns mutated, silently. The reviver runs after parsing, so numbers have already been converted to JavaScript numbers and may have lost precision by then (MDN: JSON.parse()).
Serialization bites from the other side: BigInt values throw a TypeError in JSON.stringify, while undefined values and functions disappear from objects (MDN: JSON.stringify()). The fix costs nothing: send large identifiers as strings, which the grammar handles natively. MDN documents lossless recovery with a reviver and BigInt when a legacy payload cannot be changed.
Beautifying and minifying change whitespace, not data
Beautifying adds indentation and line breaks for humans; minifying strips every optional whitespace byte for machines. Both preserve the data exactly. MDN's space argument to JSON.stringify inserts whitespace for readability: a number sets indentation spaces and is clamped at 10, while a string is inserted before each nested level and truncated to 10 characters (MDN: JSON.stringify()). That is the whole mechanism behind pretty-printing with 2 or 4 spaces.
Choose by audience: beautified JSON for reviews, logs and debugging, minified JSON for the wire and storage. Formatting never touches keys or values, so moving between the two is safe.
How the local workflow works
Five steps cover a full pass:
- Paste or drop your JSON into the editor. Parsing starts immediately, inside the tab.
- Read the syntax verdict. Validation applies the RFC 8259 grammar locally and reports line-numbered errors as you type.
- Fix flagged issues, from trailing commas to encoding artifacts, using the explanations above.
- Beautify or minify, then copy or download the result. Both transformations run locally through standard serialization.
- Check what the page requests. Open the Network tab and format a payload; the parsing step adds no request carrying your text. A full audit of the script bundle was outside this refresh, so treat that as a scoped observation, not a certification.
Common mistakes when formatting JSON
Eight repeat offenders cause most broken payloads:
- Single quotes around keys or strings. JSON accepts only double quotes.
- Trailing commas left by generators or manual edits, fatal in JSON though legal in modern JavaScript.
- Comments of any kind. Move notes into docs or a schema description field.
- Raw newlines inside string values, which must be escaped.
- Wrong-cased literals: True, False and None arrive from Python and fail; JSON requires true, false, null.
- Big numeric IDs sent as numbers, mutating past 2^53 minus 1. Quote them at the source.
- Encoding artifacts such as BOMs and UTF-16 files, causing position 0 errors that mimic syntax bugs.
- CSV pasted wholesale. Spreadsheets need a conversion step before the grammar applies.
Related tools
Validation is one step in a local-first JSON workflow. For a comparison of which formatter to choose rather than help with a payload in hand, the jsonformatter alternative and use JSON formatter online guides cover that decision.
- Check a document against a JSON Schema: move from syntax validity to shape conformance.
- JSON Diff and Compare: spot structural differences once both documents validate.
- JSON to YAML Converter: reshape validated JSON into YAML for config files.
- Decode a JSON Web Token: inspect a token payload like the one described in the opening paragraphs.
