Skip to content
uencoder

JSON5

JSON5 is a superset of JSON that allows single quotes, unquoted keys, comments, trailing commas, NaN/Infinity, and hexadecimal numbers, making it better for hand-edited configuration.

Purpose

To relax JSON syntax restrictions so configuration files are easier to write and maintain by hand.

Mechanism

On top of JSON it allows: unquoted keys, single-quoted strings, trailing commas, comments, hexadecimal numbers, NaN/Infinity/-0, and multiline strings. It parses into standard JSON values.

Use cases

  • JavaScript configuration files
  • Hand-edited configuration
  • Prototype data
  • An alternative to JSON configuration

Examples

  • Input
    {name:'Ada',age:36,}
    Output
    The object {name:"Ada", age:36}

    Single quotes plus a trailing comma

Common errors

Parsing JSON5 as standard JSON fails
Use a dedicated JSON5 parser

Related terms

Related tools

References