The JSON5 Data Interchange Format 1.0.0 (March 2018) is a superset of JSON that adds syntax from ECMAScript 5.1; the values are the same (objects, arrays, strings, numbers, Booleans, null). This page follows the JSON5 specification and, for identifier names, the ECMAScript 5.1 specification, read 2026-11-12. The JSON5 specification defines strings as sequences of Unicode characters and does not name a file encoding.
Objects and arrays
- Keys may be ECMAScript 5.1
IdentifierNames without quotes ({unquoted: 1}), or strings in single or double quotes. In ECMAScript 5.1 anIdentifierNamestarts with a Unicode letter,$,_or a\uescape, and reserved words areIdentifierNames too (onlyIdentifierexcludes them). - A single trailing comma is allowed after the last member of an object or array.
- Names within an object should be unique; with duplicates, behaviour is unpredictable.
Strings
- Strings may use single quotes; the other quote character needs no escape. The quote that opens the string, the backslash and line terminators must be escaped.
- A backslash before a line terminator (LF, CR, CR LF, U+2028 or U+2029) continues the string on the next line; neither is part of the string.
- U+2028 and U+2029 may appear unescaped, but authors should avoid them, parsers should warn and generators should escape them, since ECMAScript 5.1 does not allow them in strings.
| Escape | Character |
|---|---|
\', \", \\ | Quote, double quote, backslash |
\b, \f, \n, \r, \t, \v | Backspace, form feed, line feed, carriage return, tab, vertical tab |
\0 | NUL, when not followed by a digit |
\xHH | A character from U+0000 to U+00FF, by its 2-digit hex code |
\uHHHH | A UTF-16 code unit (pairs for characters beyond U+FFFF) |
Any other character after \ | That character itself; \1–\9 are not allowed |
Numbers
- Hexadecimal integers with
0xor0X:0xdecaf,-0xC0FFEE. - A leading or trailing decimal point:
.456,8675309.. - An explicit plus sign:
+1. - The IEEE 754 values
Infinity(optionally+Infinity),-InfinityandNaN(optionally+NaNor-NaN).
Comments and white space
// …and block comments/* … */(not nested).The example is the one from the specification. The specification names no media type, and IANA’s register of media types (read 2026-11-12) has no
application/entry for JSON5.