Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 31 million developers.Sign up
This release includes major internal changes and public API enhancements.
Major JSON5 officially supports Node.js v4 and later. Support for Node.js
v0.10 and v0.12 have been dropped.
New: Unicode property names and Unicode escapes in property names are
stringifyoutputs trailing commas in objects and arrays when a
option is provided. (#66)
New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
in strings in order to be compatible with JSON. However, ES5 does not allow
these characters in strings, so JSON5 gives a warning when they are parsed and
escapes them when they are stringified. (#70)
stringifyaccepts an options object as its second argument. The
supported options are
space, and a new
specifies the quote character used in strings. (#71)
New: In addition to the white space characters space
\xA0, the additional white space characters
and all other characters in the Space Separator Unicode category are allowed.
New: In addition to the character escapes
\t, the additional character escapes
\x0F, and unnecessary escapes like
\aare allowed in string
values and string property names.
stringifyoutputs strings with single quotes by default but
intelligently uses double quotes if there are more single quotes than double
quotes inside the string. (i.e.
New: When a character is not allowed in a string,
character escape like
\twhen available, a hexadecimal escape like
when the Unicode code point is less than 256, or a Unicode character escape
\u01FF, in that order.
stringifychecks for a
toJSON5method on objects and, if it exists,
stringifies its return value instead of the object.
toJSONif they both exist.
importJSON5 files, use
import 'json5/lib/register'. Previous versions used
which still exists for backward compatibility but is deprecated and will give
New: To use JSON5 in browsers, use the file at
stringifyno longer throws when an object does not have a
stringifyproperly handles the
toJSON5(key)follows this pattern.
Stringobjects as its
Fix: In addition to a function,
stringifyalso accepts an array of keys to
include in the output as its
Stringobjects will be converted to a string if they are given as array