1 | ### Unreleased [[code][c-unreleased], [diff][d-unreleased]]
|
---|
2 |
|
---|
3 | [c-unreleased]: https://github.com/json5/json5/tree/master
|
---|
4 | [d-unreleased]: https://github.com/json5/json5/compare/v2.2.0...HEAD
|
---|
5 |
|
---|
6 | ### v2.2.0 [[code][c2.2.0], [diff][d2.2.0]]
|
---|
7 |
|
---|
8 | [c2.2.0]: https://github.com/json5/json5/tree/v2.2.0
|
---|
9 | [d2.2.0]: https://github.com/json5/json5/compare/v2.1.3...v2.2.0
|
---|
10 |
|
---|
11 | - New: Accurate and documented TypeScript declarations are now included. There
|
---|
12 | is no need to install `@types/json5`. ([#236], [#244])
|
---|
13 |
|
---|
14 | ### v2.1.3 [[code][c2.1.3], [diff][d2.1.3]]
|
---|
15 |
|
---|
16 | [c2.1.3]: https://github.com/json5/json5/tree/v2.1.3
|
---|
17 | [d2.1.3]: https://github.com/json5/json5/compare/v2.1.2...v2.1.3
|
---|
18 |
|
---|
19 | - Fix: An out of memory bug when parsing numbers has been fixed. ([#228],
|
---|
20 | [#229])
|
---|
21 |
|
---|
22 | ### v2.1.2 [[code][c2.1.2], [diff][d2.1.2]]
|
---|
23 |
|
---|
24 | [c2.1.2]: https://github.com/json5/json5/tree/v2.1.2
|
---|
25 | [d2.1.2]: https://github.com/json5/json5/compare/v2.1.1...v2.1.2
|
---|
26 |
|
---|
27 | - Fix: Bump `minimist` to `v1.2.5`. ([#222])
|
---|
28 |
|
---|
29 | ### v2.1.1 [[code][c2.1.1], [diff][d2.1.1]]
|
---|
30 |
|
---|
31 | [c2.1.1]: https://github.com/json5/json5/tree/v2.1.1
|
---|
32 | [d2.1.1]: https://github.com/json5/json5/compare/v2.0.1...v2.1.1
|
---|
33 |
|
---|
34 | - New: `package.json` and `package.json5` include a `module` property so
|
---|
35 | bundlers like webpack, rollup and parcel can take advantage of the ES Module
|
---|
36 | build. ([#208])
|
---|
37 | - Fix: `stringify` outputs `\0` as `\\x00` when followed by a digit. ([#210])
|
---|
38 | - Fix: Spelling mistakes have been fixed. ([#196])
|
---|
39 |
|
---|
40 | ### v2.1.0 [[code][c2.1.0], [diff][d2.1.0]]
|
---|
41 |
|
---|
42 | [c2.1.0]: https://github.com/json5/json5/tree/v2.1.0
|
---|
43 | [d2.1.0]: https://github.com/json5/json5/compare/v2.0.1...v2.1.0
|
---|
44 |
|
---|
45 | - New: The `index.mjs` and `index.min.mjs` browser builds in the `dist`
|
---|
46 | directory support ES6 modules. ([#187])
|
---|
47 |
|
---|
48 | ### v2.0.1 [[code][c2.0.1], [diff][d2.0.1]]
|
---|
49 |
|
---|
50 | [c2.0.1]: https://github.com/json5/json5/tree/v2.0.1
|
---|
51 | [d2.0.1]: https://github.com/json5/json5/compare/v2.0.0...v2.0.1
|
---|
52 |
|
---|
53 | - Fix: The browser builds in the `dist` directory support ES5. ([#182])
|
---|
54 |
|
---|
55 | ### v2.0.0 [[code][c2.0.0], [diff][d2.0.0]]
|
---|
56 |
|
---|
57 | [c2.0.0]: https://github.com/json5/json5/tree/v2.0.0
|
---|
58 | [d2.0.0]: https://github.com/json5/json5/compare/v1.0.1...v2.0.0
|
---|
59 |
|
---|
60 | - **Major**: JSON5 officially supports Node.js v6 and later. Support for Node.js
|
---|
61 | v4 has been dropped. Since Node.js v6 supports ES5 features, the code has been
|
---|
62 | rewritten in native ES5, and the dependence on Babel has been eliminated.
|
---|
63 |
|
---|
64 | - New: Support for Unicode 10 has been added.
|
---|
65 |
|
---|
66 | - New: The test framework has been migrated from Mocha to Tap.
|
---|
67 |
|
---|
68 | - New: The browser build at `dist/index.js` is no longer minified by default. A
|
---|
69 | minified version is available at `dist/index.min.js`. ([#181])
|
---|
70 |
|
---|
71 | - Fix: The warning has been made clearer when line and paragraph separators are
|
---|
72 | used in strings.
|
---|
73 |
|
---|
74 | - Fix: `package.json5` has been restored, and it is automatically generated and
|
---|
75 | committed when the version is bumped. A new `build-package` NPM script has
|
---|
76 | been added to facilitate this.
|
---|
77 |
|
---|
78 | ### v1.0.1 [[code][c1.0.1], [diff][d1.0.1]]
|
---|
79 |
|
---|
80 | [c1.0.1]: https://github.com/json5/json5/tree/v1.0.1
|
---|
81 | [d1.0.1]: https://github.com/json5/json5/compare/v1.0.0...v1.0.1
|
---|
82 |
|
---|
83 | This release includes a bug fix and minor change.
|
---|
84 |
|
---|
85 | - Fix: `parse` throws on unclosed objects and arrays.
|
---|
86 |
|
---|
87 | - New: `package.json5` has been removed until an easier way to keep it in sync
|
---|
88 | with `package.json` is found.
|
---|
89 |
|
---|
90 |
|
---|
91 | ### v1.0.0 [[code][c1.0.0], [diff][d1.0.0]]
|
---|
92 |
|
---|
93 | [c1.0.0]: https://github.com/json5/json5/tree/v1.0.0
|
---|
94 | [d1.0.0]: https://github.com/json5/json5/compare/v0.5.1...v1.0.0
|
---|
95 |
|
---|
96 | This release includes major internal changes and public API enhancements.
|
---|
97 |
|
---|
98 | - **Major**: JSON5 officially supports Node.js v4 and later. Support for Node.js
|
---|
99 | v0.10 and v0.12 have been dropped.
|
---|
100 |
|
---|
101 | - New: Unicode property names and Unicode escapes in property names are
|
---|
102 | supported. ([#1])
|
---|
103 |
|
---|
104 | - New: `stringify` outputs trailing commas in objects and arrays when a `space`
|
---|
105 | option is provided. ([#66])
|
---|
106 |
|
---|
107 | - New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
|
---|
108 | in strings in order to be compatible with JSON. However, ES5 does not allow
|
---|
109 | these characters in strings, so JSON5 gives a warning when they are parsed and
|
---|
110 | escapes them when they are stringified. ([#70])
|
---|
111 |
|
---|
112 | - New: `stringify` accepts an options object as its second argument. The
|
---|
113 | supported options are `replacer`, `space`, and a new `quote` option that
|
---|
114 | specifies the quote character used in strings. ([#71])
|
---|
115 |
|
---|
116 | - New: The CLI supports STDIN and STDOUT and adds `--out-file`, `--space`, and
|
---|
117 | `--validate` options. See `json5 --help` for more information. ([#72], [#84],
|
---|
118 | and [#108])
|
---|
119 |
|
---|
120 | - New: In addition to the white space characters space `\t`, `\v`, `\f`, `\n`,
|
---|
121 | `\r`, and `\xA0`, the additional white space characters `\u2028`, `\u2029`,
|
---|
122 | and all other characters in the Space Separator Unicode category are allowed.
|
---|
123 |
|
---|
124 | - New: In addition to the character escapes `\'`, `\"`, `\\`, `\b`, `\f`, `\n`,
|
---|
125 | `\r`, and `\t`, the additional character escapes `\v` and `\0`, hexadecimal
|
---|
126 | escapes like `\x0F`, and unnecessary escapes like `\a` are allowed in string
|
---|
127 | values and string property names.
|
---|
128 |
|
---|
129 | - New: `stringify` outputs strings with single quotes by default but
|
---|
130 | intelligently uses double quotes if there are more single quotes than double
|
---|
131 | quotes inside the string. (i.e. `stringify('Stay here.')` outputs
|
---|
132 | `'Stay here.'` while `stringify('Let\'s go.')` outputs `"Let's go."`)
|
---|
133 |
|
---|
134 | - New: When a character is not allowed in a string, `stringify` outputs a
|
---|
135 | character escape like `\t` when available, a hexadecimal escape like `\x0F`
|
---|
136 | when the Unicode code point is less than 256, or a Unicode character escape
|
---|
137 | like `\u01FF`, in that order.
|
---|
138 |
|
---|
139 | - New: `stringify` checks for a `toJSON5` method on objects and, if it exists,
|
---|
140 | stringifies its return value instead of the object. `toJSON5` overrides
|
---|
141 | `toJSON` if they both exist.
|
---|
142 |
|
---|
143 | - New: To `require` or `import` JSON5 files, use `require('json5/lib/register')`
|
---|
144 | or `import 'json5/lib/register'`. Previous versions used `json5/lib/require`,
|
---|
145 | which still exists for backward compatibility but is deprecated and will give
|
---|
146 | a warning.
|
---|
147 |
|
---|
148 | - New: To use JSON5 in browsers, use the file at `dist/index.js` or
|
---|
149 | `https://unpkg.com/json5@^1.0.0`.
|
---|
150 |
|
---|
151 | - Fix: `stringify` properly outputs `Infinity` and `NaN`. ([#67])
|
---|
152 |
|
---|
153 | - Fix: `isWord` no longer becomes a property of `JSON5` after calling
|
---|
154 | `stringify`. ([#68] and [#89])
|
---|
155 |
|
---|
156 | - Fix: `stringify` no longer throws when an object does not have a `prototype`.
|
---|
157 | ([#154])
|
---|
158 |
|
---|
159 | - Fix: `stringify` properly handles the `key` argument of `toJSON(key)` methods.
|
---|
160 | `toJSON5(key)` follows this pattern.
|
---|
161 |
|
---|
162 | - Fix: `stringify` accepts `Number` and `String` objects as its `space`
|
---|
163 | argument.
|
---|
164 |
|
---|
165 | - Fix: In addition to a function, `stringify` also accepts an array of keys to
|
---|
166 | include in the output as its `replacer` argument. Numbers, `Number` objects,
|
---|
167 | and `String` objects will be converted to a string if they are given as array
|
---|
168 | values.
|
---|
169 |
|
---|
170 |
|
---|
171 | ### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
|
---|
172 |
|
---|
173 | [c0.5.1]: https://github.com/json5/json5/tree/v0.5.1
|
---|
174 | [d0.5.1]: https://github.com/json5/json5/compare/v0.5.0...v0.5.1
|
---|
175 |
|
---|
176 | This release includes a minor fix for indentations when stringifying empty
|
---|
177 | arrays.
|
---|
178 |
|
---|
179 | - Fix: Indents no longer appear in empty arrays when stringified. ([#134])
|
---|
180 |
|
---|
181 |
|
---|
182 | ### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
|
---|
183 |
|
---|
184 | [c0.5.0]: https://github.com/json5/json5/tree/v0.5.0
|
---|
185 | [d0.5.0]: https://github.com/json5/json5/compare/v0.4.0...v0.5.0
|
---|
186 |
|
---|
187 | This release includes major internal changes and public API enhancements.
|
---|
188 |
|
---|
189 | - **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
|
---|
190 | Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
|
---|
191 | remain.
|
---|
192 |
|
---|
193 | - Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
|
---|
194 |
|
---|
195 | - New: `parse` and the CLI provide line and column numbers when displaying error
|
---|
196 | messages. ([#101]; awesome work by [@amb26].)
|
---|
197 |
|
---|
198 |
|
---|
199 | ### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
|
---|
200 |
|
---|
201 | [c0.4.0]: https://github.com/json5/json5/tree/v0.4.0
|
---|
202 | [d0.4.0]: https://github.com/json5/json5/compare/v0.2.0...v0.4.0
|
---|
203 |
|
---|
204 | Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
|
---|
205 | changelog entry includes v0.3.0 features.
|
---|
206 |
|
---|
207 | This is a massive release that adds `stringify` support, among other things.
|
---|
208 |
|
---|
209 | - **Major:** `JSON5.stringify()` now exists!
|
---|
210 | This method is analogous to the native `JSON.stringify()`;
|
---|
211 | it just avoids quoting keys where possible.
|
---|
212 | See the [usage documentation](./README.md#usage) for more.
|
---|
213 | ([#32]; huge thanks and props [@aeisenberg]!)
|
---|
214 |
|
---|
215 | - New: `NaN` and `-NaN` are now allowed number literals.
|
---|
216 | ([#30]; thanks [@rowanhill].)
|
---|
217 |
|
---|
218 | - New: Duplicate object keys are now allowed; the last value is used.
|
---|
219 | This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
|
---|
220 |
|
---|
221 | - Fix: Properly handle various whitespace and newline cases now.
|
---|
222 | E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
|
---|
223 | and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
|
---|
224 | ([#58], [#60], and [#63]; thanks [@jordanbtucker].)
|
---|
225 |
|
---|
226 | - New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
|
---|
227 | (They were disallowed in v0.2.0; see below.)
|
---|
228 | It turns out they *are* valid in ES5, so JSON5 supports them now too.
|
---|
229 | ([#36]; thanks [@jordanbtucker]!)
|
---|
230 |
|
---|
231 |
|
---|
232 | ### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
|
---|
233 |
|
---|
234 | [c0.2.0]: https://github.com/json5/json5/tree/v0.2.0
|
---|
235 | [d0.2.0]: https://github.com/json5/json5/compare/v0.1.0...v0.2.0
|
---|
236 |
|
---|
237 | This release fixes some bugs and adds some more utility features to help you
|
---|
238 | express data more easily:
|
---|
239 |
|
---|
240 | - **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
|
---|
241 | While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
|
---|
242 | in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
|
---|
243 | and Node), so JSON5 officially rejects them now, too. ([#36])
|
---|
244 |
|
---|
245 | - New: Trailing decimal points in decimal numbers are allowed again.
|
---|
246 | (They were disallowed in v0.1.0; see below.)
|
---|
247 | They're allowed by ES5, and differentiating between integers and floats may
|
---|
248 | make sense on some platforms. ([#16]; thanks [@Midar].)
|
---|
249 |
|
---|
250 | - New: `Infinity` and `-Infinity` are now allowed number literals.
|
---|
251 | ([#30]; thanks [@pepkin88].)
|
---|
252 |
|
---|
253 | - New: Plus signs (`+`) in front of numbers are now allowed, since it can
|
---|
254 | be helpful in some contexts to explicitly mark numbers as positive.
|
---|
255 | (E.g. when a property represents changes or deltas.)
|
---|
256 |
|
---|
257 | - Fix: unescaped newlines in strings are rejected now.
|
---|
258 | ([#24]; thanks [@Midar].)
|
---|
259 |
|
---|
260 |
|
---|
261 | ### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
|
---|
262 |
|
---|
263 | [c0.1.0]: https://github.com/json5/json5/tree/v0.1.0
|
---|
264 | [d0.1.0]: https://github.com/json5/json5/compare/v0.0.1...v0.1.0
|
---|
265 |
|
---|
266 | This release tightens JSON5 support and adds helpful utility features:
|
---|
267 |
|
---|
268 | - New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
|
---|
269 |
|
---|
270 | - Fix: Reject octal numbers properly now. Previously, they were accepted but
|
---|
271 | improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
|
---|
272 |
|
---|
273 | - **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
|
---|
274 | leading zero). These are disallowed by both JSON5 and JSON, as well as by
|
---|
275 | ES5's strict mode. (Thanks [@MaxNanasy].)
|
---|
276 |
|
---|
277 | - New: Support leading decimal points in decimal numbers.
|
---|
278 | (Thanks [@MaxNanasy].)
|
---|
279 |
|
---|
280 | - **Breaking:** Reject trailing decimal points in decimal numbers now. These
|
---|
281 | are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
|
---|
282 |
|
---|
283 | - **Breaking:** Reject omitted elements in arrays now. These are disallowed by
|
---|
284 | both JSON5 and JSON.
|
---|
285 |
|
---|
286 | - Fix: Throw proper `SyntaxError` instances on errors now.
|
---|
287 |
|
---|
288 | - New: Add Node.js `require()` hook. Register via `json5/lib/require`.
|
---|
289 |
|
---|
290 | - New: Add Node.js `json5` executable to compile JSON5 files to JSON.
|
---|
291 |
|
---|
292 |
|
---|
293 | ### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
|
---|
294 |
|
---|
295 | [c0.0.1]: https://github.com/json5/json5/tree/v0.0.1
|
---|
296 | [d0.0.1]: https://github.com/json5/json5/compare/v0.0.0...v0.0.1
|
---|
297 |
|
---|
298 | This was the first implementation of this JSON5 parser.
|
---|
299 |
|
---|
300 | - Support unquoted object keys, including reserved words. Unicode characters
|
---|
301 | and escape sequences sequences aren't yet supported.
|
---|
302 |
|
---|
303 | - Support single-quoted strings.
|
---|
304 |
|
---|
305 | - Support multi-line strings.
|
---|
306 |
|
---|
307 | - Support trailing commas in arrays and objects.
|
---|
308 |
|
---|
309 | - Support comments, both inline and block.
|
---|
310 |
|
---|
311 |
|
---|
312 | ### v0.0.0 [[code](https://github.com/json5/json5/tree/v0.0.0)]
|
---|
313 |
|
---|
314 | Let's consider this to be Douglas Crockford's original [json_parse.js] — a
|
---|
315 | parser for the regular JSON format.
|
---|
316 |
|
---|
317 |
|
---|
318 | [json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
---|
319 | [v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
|
---|
320 |
|
---|
321 | [@MaxNanasy]: https://github.com/MaxNanasy
|
---|
322 | [@Midar]: https://github.com/Midar
|
---|
323 | [@pepkin88]: https://github.com/pepkin88
|
---|
324 | [@rowanhill]: https://github.com/rowanhill
|
---|
325 | [@aeisenberg]: https://github.com/aeisenberg
|
---|
326 | [@jordanbtucker]: https://github.com/jordanbtucker
|
---|
327 | [@amb26]: https://github.com/amb26
|
---|
328 |
|
---|
329 | [#1]: https://github.com/json5/json5/issues/1
|
---|
330 | [#16]: https://github.com/json5/json5/issues/16
|
---|
331 | [#24]: https://github.com/json5/json5/issues/24
|
---|
332 | [#30]: https://github.com/json5/json5/issues/30
|
---|
333 | [#32]: https://github.com/json5/json5/issues/32
|
---|
334 | [#36]: https://github.com/json5/json5/issues/36
|
---|
335 | [#57]: https://github.com/json5/json5/issues/57
|
---|
336 | [#58]: https://github.com/json5/json5/pull/58
|
---|
337 | [#60]: https://github.com/json5/json5/pull/60
|
---|
338 | [#63]: https://github.com/json5/json5/pull/63
|
---|
339 | [#66]: https://github.com/json5/json5/issues/66
|
---|
340 | [#67]: https://github.com/json5/json5/issues/67
|
---|
341 | [#68]: https://github.com/json5/json5/issues/68
|
---|
342 | [#70]: https://github.com/json5/json5/issues/70
|
---|
343 | [#71]: https://github.com/json5/json5/issues/71
|
---|
344 | [#72]: https://github.com/json5/json5/issues/72
|
---|
345 | [#84]: https://github.com/json5/json5/pull/84
|
---|
346 | [#89]: https://github.com/json5/json5/pull/89
|
---|
347 | [#97]: https://github.com/json5/json5/pull/97
|
---|
348 | [#101]: https://github.com/json5/json5/pull/101
|
---|
349 | [#108]: https://github.com/json5/json5/pull/108
|
---|
350 | [#134]: https://github.com/json5/json5/pull/134
|
---|
351 | [#154]: https://github.com/json5/json5/issues/154
|
---|
352 | [#181]: https://github.com/json5/json5/issues/181
|
---|
353 | [#182]: https://github.com/json5/json5/issues/182
|
---|
354 | [#187]: https://github.com/json5/json5/issues/187
|
---|
355 | [#196]: https://github.com/json5/json5/issues/196
|
---|
356 | [#208]: https://github.com/json5/json5/issues/208
|
---|
357 | [#210]: https://github.com/json5/json5/issues/210
|
---|
358 | [#222]: https://github.com/json5/json5/issues/222
|
---|
359 | [#228]: https://github.com/json5/json5/issues/228
|
---|
360 | [#229]: https://github.com/json5/json5/issues/229
|
---|
361 | [#236]: https://github.com/json5/json5/issues/236
|
---|
362 | [#244]: https://github.com/json5/json5/issues/244
|
---|