Introduction
JSON5 is an extension of JSON that is easier to write by hand. It allows the things people most often miss in JSON, such as comments and trailing commas, by borrowing them from JavaScript (ECMAScript 5, which gives it its name). Every JSON file is also valid JSON5, but not the other way round.
It is used for hand-edited configuration files, for example by the Chromium project and by some JavaScript build tools.
Structure
A JSON5 file is UTF-8 text holding one value, like JSON. On top of JSON it allows:
- comments, both
// lineand/* block */ - a trailing comma after the last item of an object or array
- object keys without quotes, when they are valid JavaScript names
- strings in single quotes, and strings continued over lines with a backslash
- hexadecimal numbers, a leading or trailing decimal point, a plus sign, and
InfinityandNaN - more kinds of white space
Links
Software
- Visual Studio Code (Windows, macOS, Linux)
- Sublime Text (Windows, macOS, Linux)
Developers
Reference
- The JSON5 Data Interchange Format, the specification