Free Online Validator: JSON6

Paste text and find out instantly whether it is valid JSON6, with the exact line and column of any syntax error.

TL;DR: Paste or type below. The validator parses your text with the reference json-6 parser as you type, reports OK or the error with its line and column, and highlights the offending line. It also catches trailing text after the first value, which JSON6.parse() would silently ignore. Everything runs locally in your browser.

Validate JSON6 Online

A sample using back-ticks, underscores, binary and octal numbers, undefined and an empty array member is preloaded. Edit it, break it, or paste your own file.

Private by design: everything runs locally in your browser using the reference json-6 parser. Your text is never uploaded, logged or sent to any server, and it is gone when you close the tab.

How the Validator Works

The validator runs your text through the reference JSON6 parser, the json-6 package by d3x0r, loaded into this page as a plain script. If JSON6.parse() succeeds, the validator then feeds the same text to the streaming parser, JSON6.begin(), to count how many top-level values it contains and to see whether anything unparseable follows the first one. Only text that is exactly one valid value is reported as valid.

That second check matters. In json-6 1.1.7, JSON6.parse('{a:1} {b:2}') returns {a:1} and JSON6.parse('{a:1}x') returns {a:1} too: the parser stops after the first complete value. A validator that only called parse() would therefore call a broken file fine. This page does not.

Validation runs on every keystroke, so you can fix a problem and watch the red banner turn green without pressing anything. Large documents are parsed synchronously, which is fine for configuration-sized input; a multi-megabyte file may pause the page briefly.

What Counts as Valid

The validator accepts the full JSON6 syntax. Every valid JSON document passes, every JSON5 document passes, and so does anything using the JSON6 additions:

FeatureExample
Comments// line and /* block */
Unquoted keys, single quotes, trailing commas{ a: 'x', }
Back-tick strings (no substitution)`text`
Multi-line strings in every quote stylea raw line break inside the quotes
Underscore separators1_000_000
Binary and octal0b1010, 0o755
Hexadecimal, .5, 5., +10xFF
Leading-zero decimals0123 is 123
undefined keyword{ a: undefined }
Empty array members[1,,2]
Infinity and NaN-Infinity, NaN

Things that are still invalid: bare words that are not keywords, a missing comma between members, an empty document, unterminated strings and comments, a comma directly after a key, and more than one top-level value. The exact rules live in the syntax guide.

Reading Error Messages

json-6 throws a plain Error. Unlike the JSON5 reference parser it does not attach lineNumber or columnNumber properties; the position is appended to the message text as [line:column], counted from 1. The validator extracts that suffix to print the surrounding lines and place a caret. The messages you will meet most often:

  • fault parsing 'x' unexpected - the parser met a character that cannot appear at that point, such as a missing comma between two members or a stray symbol.
  • Incomplete string - a quote was opened and the text ended before it closed.
  • Open comment is missing close - a /* was never terminated.
  • No value found in document - the text is empty, only whitespace or comments, or it ends before the first value completes, as in [1,2.

The reported position is where the parser noticed the problem, which is sometimes just after the real mistake. If the highlighted line looks fine, check the line above it. The parse error guide covers each message in depth.

Example: a typical failure

{ name: 'demo' version: 2, }

The comma after 'demo' is missing, so the parser stops at version on line 3 and reports the failure there.

Examples to Try

Paste each of these into the box above to see how the validator responds.

Valid: JSON6-only syntax

{ big: 1_000_000, mask: 0b1111_0000, perms: 0o755, gone: undefined, text: `two lines`, holes: [1,,3], }

Invalid: two top-level values

{ a: 1 } { b: 2 }

Each value is fine alone. A document is one value, so wrap several records in an array.

Invalid: an unterminated string

{ name: 'oops }

Invalid: an empty member in an object

{ a: , b: 2 }

Empty members are allowed in arrays only. In an object the parser rejects the comma after a:.

FAQ

Is my data sent to a server?

No. The parser runs entirely in your browser. There is no upload, and the text is not stored. Closing the tab discards it.

Does it validate against a schema?

No. It checks syntax only: whether the text is well-formed JSON6. Shape checks belong in your application after JSON6.parse().

Why is a file with text after the closing brace rejected?

Because the reference parse() would read the first value and quietly drop the rest, which hides mistakes. The validator reports it.

Why does it accept 0123 and --1?

JSON6 deliberately allows leading-zero decimals (0123 is 123) and multiple leading signs. See the numbers reference.

Keep Going

Format, convert or minify the same text with the sibling tools, or read the full syntax reference.