File SyntaxJSON

Lax Syntax

JSON relies on a strict syntax, and parsers typically fail at the first syntax error. Some parsers, especially in HTML contexts, adopt a more lenient approach with preference to capturing as much data as possible. In most cases, we will try to recover from common syntax errors, but annotate them with warnings to promote resolution and broad client-compatibility.

Examples

Try it
WARNING decoder/public.json#RecoveredSyntaxBlockComment

The source contained invalid syntax that we ignored (block comment), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxLineComment

The source contained invalid syntax that we ignored (line comment), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxLiteralCaseInsensitive

The source contained invalid syntax that we ignored (invalid literal; e.g. "TRUE" -> "true"), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxNumberLeadingZero

The source contained invalid syntax that we ignored (leading zero), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxStringInvalidEscape

The source contained invalid syntax that we ignored (invalid escape; e.g. "\\ " -> "\\ "), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxStringMissingEscape

The source contained invalid syntax that we ignored (missing escape; e.g. "\n" -> "\\n"), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxStringUnicodeReplacementChar

The source contained invalid syntax that we ignored (invalid Unicode; e.g. "\\uD800" -> "\\uFFFD"), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#RecoveredSyntaxExtraComma

The source contained invalid syntax that we ignored (extra comma), but the original may be problematic for other clients.

Try it
WARNING decoder/public.json#DuplicateObjectKey

The source contained an object with a duplicate key, so some data was ignored.