JSON5 Validator

Validate JSON5 and re-emit it as pretty JSON

JSON5 Input

Output

Formatted JSON will appear here

About

Validate JSON5 documents (JSON with comments, trailing commas, unquoted keys and single-quoted strings) and re-emit them as pretty-printed JSON. Useful for config files (tsconfig, eslint) and modern JSON5 configs. Runs in your browser.

    Examples

    Parse JSON5 with comments and trailing commas

    Input
    {
      // pick a theme
      theme: 'dark',
      features: [
        'search',
        'share',
      ],
    }
    Output
    Valid JSON5
    Keys: theme, features
    Type: object

    Single-line comments, unquoted keys, single-quoted strings, and trailing commas are all valid JSON5 — the parser accepts them and reports the document structure.

    Format JSON5 to standard JSON

    Input
    JSON5: { a:1, b:[2,3,] }
    Output
    {
      "a": 1,
      "b": [
        2,
        3
      ]
    }

    Converts to strict JSON by adding quotes, removing the trailing comma, and pretty-printing with the chosen indent.

    About this tool

    JSON5 Validator parses and formats JSON5 — a backwards-compatible superset of JSON that adds comments, trailing commas, unquoted object keys, single-quoted strings, and hexadecimal numbers. It is useful for hand-edited config files where comments and trailing commas save real editing time.

    The tool validates that the document is well-formed, displays the parsed structure, and can convert JSON5 to strict JSON in one click so the data can be fed to APIs and tools that only accept vanilla JSON. Parsing and formatting run entirely in your browser; the input is never transmitted or stored.

    How to use

    1. Paste your JSON5

      Drop a JSON5 document into the editor, or load a sample to see comments, trailing commas, and unquoted keys in action.

    2. Review the result

      The tool reports whether the document is valid and shows the parsed structure. Any parse error is shown with its line and column.

    3. Convert to JSON

      Click Format to pretty-print, or Convert to JSON to produce a strict, double-quoted JSON document you can send to strict consumers.

    Use cases

    Writing human-friendly config files

    Use JSON5 for hand-edited config files (tool configs, fixture data, design tokens) when comments and trailing commas save real editing time.

    Validating pre-commit JSON5

    Lint your JSON5 config before committing so a stray syntax error doesn't surface at runtime.

    Bridging JSON5 to strict consumers

    Convert relaxed JSON5 to standard JSON before feeding it to an API or a library that doesn't accept JSON5.

    Common mistakes

    Mistake:Assuming JSON5 is a JSON superset across all libraries.

    Fix:Most JSON5 features are supported by the standard library, but some edge cases (mixed hex literals, extended strings) may differ. Validate before relying on a less-common feature.

    Mistake:Shipping JSON5 to a strict consumer.

    Fix:Many APIs and tools only accept strict JSON. Run the conversion step before sending the data anywhere.

    Mistake:Forgetting that quoted and unquoted keys are not interchangeable in tooling.

    Fix:Unquoted keys must be valid identifiers. A key like 'first-name' has to be quoted; an unquoted 'first-name' is a parse error.

    Frequently asked questions

    References & standards