json 2.6.3 → 2.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/BSDL +22 -0
- data/CHANGES.md +188 -17
- data/LEGAL +8 -0
- data/README.md +67 -224
- data/ext/json/ext/fbuffer/fbuffer.h +144 -95
- data/ext/json/ext/generator/extconf.rb +8 -2
- data/ext/json/ext/generator/generator.c +1043 -810
- data/ext/json/ext/parser/extconf.rb +6 -27
- data/ext/json/ext/parser/parser.c +1227 -3209
- data/ext/json/ext/vendor/fpconv.c +479 -0
- data/ext/json/ext/vendor/jeaiii-ltoa.h +267 -0
- data/json.gemspec +48 -52
- data/lib/json/add/bigdecimal.rb +39 -10
- data/lib/json/add/complex.rb +29 -6
- data/lib/json/add/core.rb +1 -1
- data/lib/json/add/date.rb +27 -7
- data/lib/json/add/date_time.rb +26 -9
- data/lib/json/add/exception.rb +25 -7
- data/lib/json/add/ostruct.rb +32 -9
- data/lib/json/add/range.rb +33 -8
- data/lib/json/add/rational.rb +28 -6
- data/lib/json/add/regexp.rb +26 -8
- data/lib/json/add/set.rb +25 -6
- data/lib/json/add/struct.rb +29 -7
- data/lib/json/add/symbol.rb +34 -7
- data/lib/json/add/time.rb +29 -15
- data/lib/json/common.rb +648 -249
- data/lib/json/ext/generator/state.rb +106 -0
- data/lib/json/ext.rb +34 -4
- data/lib/json/generic_object.rb +7 -3
- data/lib/json/truffle_ruby/generator.rb +690 -0
- data/lib/json/version.rb +3 -7
- data/lib/json.rb +25 -21
- metadata +17 -26
- data/VERSION +0 -1
- data/ext/json/ext/generator/depend +0 -1
- data/ext/json/ext/generator/generator.h +0 -174
- data/ext/json/ext/parser/depend +0 -1
- data/ext/json/ext/parser/parser.h +0 -96
- data/ext/json/ext/parser/parser.rl +0 -986
- data/ext/json/extconf.rb +0 -3
- data/lib/json/pure/generator.rb +0 -479
- data/lib/json/pure/parser.rb +0 -337
- data/lib/json/pure.rb +0 -15
- /data/{LICENSE → COPYING} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1919e2040a180b81eba1f475c511ace075b32015997b7d58098f93103941f8b2
|
4
|
+
data.tar.gz: d958784bea1136d935835d3e602fae96f97d25208cafec8a68db03619e6d34d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 742da3e909b2b6d8c1c9de5833b11be0f80e3b50f5296973b57f03cd45ae584162ac33bcbeb5b99fa767714b8531fef71b6d7ff559da40c3b04e75026ba3158f
|
7
|
+
data.tar.gz: e55ae407cc5b0da66922a41119b000da925391b58ea9da154a058b15f034334fae9e9c813cda12f4db75936c50e281df00acf8a4053808923d89d5efaa6927af
|
data/BSDL
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions
|
5
|
+
are met:
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
22
|
+
SUCH DAMAGE.
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,164 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
### 2025-04-25 (2.11.3)
|
4
|
+
|
5
|
+
* Fix a regression in `JSON.pretty_generate` that could cause indentation to be off once some `#to_json` has been called.
|
6
|
+
|
7
|
+
### 2025-04-24 (2.11.2)
|
8
|
+
|
9
|
+
* Add back `JSON::PRETTY_STATE_PROTOTYPE`. This constant was private API but is used by popular gems like `multi_json`.
|
10
|
+
It now emits a deprecation warning.
|
11
|
+
|
12
|
+
### 2025-04-24 (2.11.1)
|
13
|
+
|
14
|
+
* Add back `JSON.restore`, `JSON.unparse`, `JSON.fast_unparse` and `JSON.pretty_unparse`.
|
15
|
+
These were deprecated 16 years ago, but never emited warnings, only undocumented, so are
|
16
|
+
still used by a few gems.
|
17
|
+
|
18
|
+
### 2025-04-24 (2.11.0)
|
19
|
+
|
20
|
+
* Optimize Integer generation to be ~1.8x faster.
|
21
|
+
* Optimize Float generation to be ~10x faster.
|
22
|
+
* Fix `JSON.load` proc argument to substitute the parsed object with the return value.
|
23
|
+
This better match `Marshal.load` behavior.
|
24
|
+
* Deprecate `JSON.fast_generate` (it's not any faster, so pointless).
|
25
|
+
* Deprecate `JSON.load_default_options`.
|
26
|
+
* Deprecate `JSON.unsafe_load_default_options`.
|
27
|
+
* Deprecate `JSON.dump_default_options`.
|
28
|
+
* Deprecate `Kernel#j`
|
29
|
+
* Deprecate `Kernel#jj`
|
30
|
+
* Remove outdated `JSON.iconv`.
|
31
|
+
* Remove `Class#json_creatable?` monkey patch.
|
32
|
+
* Remove deprecated `JSON.restore` method.
|
33
|
+
* Remove deprecated `JSON.unparse` method.
|
34
|
+
* Remove deprecated `JSON.fast_unparse` method.
|
35
|
+
* Remove deprecated `JSON.pretty_unparse` method.
|
36
|
+
* Remove deprecated `JSON::UnparserError` constant.
|
37
|
+
* Remove outdated `JSON::MissingUnicodeSupport` constant.
|
38
|
+
|
39
|
+
### 2025-03-12 (2.10.2)
|
40
|
+
|
41
|
+
* Fix a potential crash in the C extension parser.
|
42
|
+
* Raise a ParserError on all incomplete unicode escape sequence. This was the behavior until `2.10.0` unadvertently changed it.
|
43
|
+
* Ensure document snippets that are included in parser errors don't include truncated multibyte characters.
|
44
|
+
* Ensure parser error snippets are valid UTF-8.
|
45
|
+
* Fix `JSON::GeneratorError#detailed_message` on Ruby < 3.2
|
46
|
+
|
47
|
+
### 2025-02-10 (2.10.1)
|
48
|
+
|
49
|
+
* Fix a compatibility issue with `MultiJson.dump(obj, pretty: true)`: `no implicit conversion of false into Proc (TypeError)`.
|
50
|
+
|
51
|
+
### 2025-02-10 (2.10.0)
|
52
|
+
|
53
|
+
* `strict: true` now accept symbols as values. Previously they'd only be accepted as hash keys.
|
54
|
+
* The C extension Parser has been entirely reimplemented from scratch.
|
55
|
+
* Introduced `JSON::Coder` as a new API allowing to customize how non native types are serialized in a non-global way.
|
56
|
+
* Introduced `JSON::Fragment` to allow assembling cached fragments in a safe way.
|
57
|
+
* The Java implementation of the generator received many optimizations.
|
58
|
+
|
59
|
+
### 2024-12-18 (2.9.1)
|
60
|
+
|
61
|
+
* Fix support for Solaris 10.
|
62
|
+
|
63
|
+
### 2024-12-03 (2.9.0)
|
64
|
+
|
65
|
+
* Fix C implementation of `script_safe` escaping to not confuse some other 3 wide characters with `\u2028` and `\u2029`.
|
66
|
+
e.g. `JSON.generate(["倩", "瀨"], script_safe: true)` would generate the wrong JSON.
|
67
|
+
* `JSON.dump(object, some_io)` now write into the IO in chunks while previously it would buffer the entire JSON before writing.
|
68
|
+
* `JSON::GeneratorError` now has a `#invalid_object` attribute, making it easier to understand why an object tree cannot be serialized.
|
69
|
+
* Numerous improvements to the JRuby extension.
|
70
|
+
|
71
|
+
### 2024-11-14 (2.8.2)
|
72
|
+
|
73
|
+
* `JSON.load_file` explictly read the file as UTF-8.
|
74
|
+
|
75
|
+
### 2024-11-06 (2.8.1)
|
76
|
+
|
77
|
+
* Fix the java packages to include the extension.
|
78
|
+
|
79
|
+
### 2024-11-06 (2.8.0)
|
80
|
+
|
81
|
+
* Emit a deprecation warning when `JSON.load` create custom types without the `create_additions` option being explictly enabled.
|
82
|
+
* Prefer to use `JSON.unsafe_load(string)` or `JSON.load(string, create_additions: true)`.
|
83
|
+
* Emit a deprecation warning when serializing valid UTF-8 strings encoded in `ASCII_8BIT` aka `BINARY`.
|
84
|
+
* Bump required Ruby version to 2.7.
|
85
|
+
* Add support for optionally parsing trailing commas, via `allow_trailing_comma: true`, which in cunjunction with the
|
86
|
+
pre-existing support for comments, make it suitable to parse `jsonc` documents.
|
87
|
+
* Many performance improvements to `JSON.parse` and `JSON.load`, up to `1.7x` faster on real world documents.
|
88
|
+
* Some minor performance improvements to `JSON.dump` and `JSON.generate`.
|
89
|
+
* `JSON.pretty_generate` no longer include newline inside empty object and arrays.
|
90
|
+
|
91
|
+
### 2024-11-04 (2.7.6)
|
92
|
+
|
93
|
+
* Fix a regression in JSON.generate when dealing with Hash keys that are string subclasses, call `to_json` on them.
|
94
|
+
|
95
|
+
### 2024-10-25 (2.7.5)
|
96
|
+
|
97
|
+
* Fix a memory leak when `#to_json` methods raise an exception.
|
98
|
+
* Gracefully handle formatting configs being set to `nil` instead of `""`.
|
99
|
+
* Workaround another issue caused by conflicting versions of both `json_pure` and `json` being loaded.
|
100
|
+
|
101
|
+
### 2024-10-25 (2.7.4)
|
102
|
+
|
103
|
+
* Workaround a bug in 3.4.8 and older https://github.com/rubygems/rubygems/pull/6490.
|
104
|
+
This bug would cause some gems with native extension to fail during compilation.
|
105
|
+
* Workaround different versions of `json` and `json_pure` being loaded (not officially supported).
|
106
|
+
* Make `json_pure` Ractor compatible.
|
107
|
+
|
108
|
+
### 2024-10-24 (2.7.3)
|
109
|
+
|
110
|
+
* Numerous performance optimizations in `JSON.generate` and `JSON.dump` (up to 2 times faster).
|
111
|
+
* Limit the size of ParserError exception messages, only include up to 32 bytes of the unparseable source.
|
112
|
+
* Fix json-pure's `Object#to_json` to accept non state arguments
|
113
|
+
* Fix multiline comment support in `json-pure`.
|
114
|
+
* Fix `JSON.parse` to no longer mutate the argument encoding when passed an ASCII-8BIT string.
|
115
|
+
* Fix `String#to_json` to raise on invalid encoding in `json-pure`.
|
116
|
+
* Delete code that was based on CVTUTF.
|
117
|
+
* Use the pure-Ruby generator on TruffleRuby.
|
118
|
+
* Fix `strict` mode in `json-pure` to not break on Integer.
|
119
|
+
|
120
|
+
### 2024-04-04 (2.7.2)
|
121
|
+
|
122
|
+
* Use rb_sym2str instead of SYM2ID #561
|
123
|
+
* Fix memory leak when exception is raised during JSON generation #574
|
124
|
+
* Remove references to "19" methods in JRuby #576
|
125
|
+
* Make OpenStruct support as optional by @hsbt in #565
|
126
|
+
* Autoload JSON::GenericObject to avoid require ostruct warning in Ruby 3.4 #577
|
127
|
+
* Warn to install ostruct if json couldn't load it by @hsbt #578
|
128
|
+
|
129
|
+
### 2023-12-05 (2.7.1)
|
130
|
+
|
131
|
+
* JSON.dump: handle unenclosed hashes regression #554
|
132
|
+
* Overload kwargs in JSON.dump #556
|
133
|
+
* [DOC] RDoc for additions #557
|
134
|
+
* Fix JSON.dump overload combination #558
|
135
|
+
|
136
|
+
### 2023-12-01 (2.7.0)
|
137
|
+
|
138
|
+
* Add a strict option to Generator #519
|
139
|
+
* `escape_slash` option was renamed as `script_safe` and now also escape U+2028 and U+2029. `escape_slash` is now an alias of `script_safe` #525
|
140
|
+
* Remove unnecessary initialization of create_id in JSON.parse() #454
|
141
|
+
* Improvements to Hash#to_json in pure implementation generator #203
|
142
|
+
* Use ruby_xfree to free buffers #518
|
143
|
+
* Fix "unexpected token" offset for Infinity #507
|
144
|
+
* Avoid using deprecated BigDecimal.new on JRuby #546
|
145
|
+
* Removed code for Ruby 1.8 #540
|
146
|
+
* Rename JSON::ParseError to JSON:ParserError #530
|
147
|
+
* Call super in included hook #486
|
148
|
+
* JRuby requires a minimum of Java 8 #516
|
149
|
+
* Always indent even if empty #517
|
150
|
+
|
151
|
+
### 2022-11-30 (2.6.3)
|
152
|
+
|
153
|
+
* bugfix json/pure mixing escaped with literal unicode raises Encoding::CompatibilityError #483
|
154
|
+
* Stop including the parser source __LINE__ in exceptions #470
|
155
|
+
|
156
|
+
### 2022-11-17 (2.6.2)
|
157
|
+
|
158
|
+
* Remove unknown keyword arg from DateTime.parse #488
|
159
|
+
* Ignore java artifacts by @hsbt #489
|
160
|
+
* Fix parser bug for empty string allocation #496
|
161
|
+
|
3
162
|
### 2021-10-24 (2.6.1)
|
4
163
|
|
5
164
|
* Restore version.rb with 2.6.1
|
@@ -105,6 +264,19 @@
|
|
105
264
|
I changed these mentions to be consistent with the Ruby license setting in
|
106
265
|
the gemspec files which were already correct now.
|
107
266
|
|
267
|
+
## 2017-01-13 (1.8.6)
|
268
|
+
* Be compatible with ancient ruby 1.8 (maybe?)
|
269
|
+
|
270
|
+
## 2015-09-11 (1.8.5)
|
271
|
+
* Be compatible with ruby 2.4.0
|
272
|
+
* There were still some mentions of dual GPL licensing in the source, but JSON
|
273
|
+
has just the Ruby license that itself includes an explicit dual-licensing
|
274
|
+
clause that allows covered software to be distributed under the terms of
|
275
|
+
the Simplified BSD License instead for all ruby versions >= 1.9.3. This is
|
276
|
+
however a GPL compatible license according to the Free Software Foundation.
|
277
|
+
I changed these mentions to be consistent with the Ruby license setting in
|
278
|
+
the gemspec files which were already correct now.
|
279
|
+
|
108
280
|
## 2015-06-01 (1.8.3)
|
109
281
|
* Fix potential memory leak, thx to nobu.
|
110
282
|
|
@@ -122,7 +294,7 @@
|
|
122
294
|
* Remove Rubinius exception since transcoding should be working now.
|
123
295
|
|
124
296
|
## 2013-05-13 (1.8.0)
|
125
|
-
* Fix https://github.com/
|
297
|
+
* Fix https://github.com/ruby/json/issues/162 reported by Marc-Andre
|
126
298
|
Lafortune <github_rocks@marc-andre.ca>. Thanks!
|
127
299
|
* Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress warning with
|
128
300
|
-Wchar-subscripts and better validate UTF-8 strings.
|
@@ -142,7 +314,7 @@
|
|
142
314
|
JSON::GenericObject.json_creatable = true
|
143
315
|
as well.
|
144
316
|
* Remove useless assert in fbuffer implementation.
|
145
|
-
* Apply patch attached to https://github.com/
|
317
|
+
* Apply patch attached to https://github.com/ruby/json/issues#issue/155
|
146
318
|
provided by John Shahid <jvshahid@gmail.com>, Thx!
|
147
319
|
* Add license information to rubygems spec data, reported by Jordi Massaguer Pla <jmassaguerpla@suse.de>.
|
148
320
|
* Improve documentation, thx to Zachary Scott <zachary@zacharyscott.net>.
|
@@ -156,7 +328,7 @@
|
|
156
328
|
* Fix compilation of extension on older rubies.
|
157
329
|
|
158
330
|
## 2012-07-26 (1.7.4)
|
159
|
-
* Fix compilation problem on AIX, see https://github.com/
|
331
|
+
* Fix compilation problem on AIX, see https://github.com/ruby/json/issues/142
|
160
332
|
|
161
333
|
## 2012-05-12 (1.7.3)
|
162
334
|
* Work around Rubinius encoding issues using iconv for conversion instead.
|
@@ -178,9 +350,9 @@
|
|
178
350
|
* Propagate src encoding to values made from it (fixes 1.9 mode converting
|
179
351
|
everything to ascii-8bit; harmless for 1.8 mode too) (Thomas E. Enebo
|
180
352
|
<tom.enebo@gmail.com>), should fix
|
181
|
-
https://github.com/
|
182
|
-
* Fix https://github.com/
|
183
|
-
* Fix https://github.com/
|
353
|
+
https://github.com/ruby/json/issues#issue/119.
|
354
|
+
* Fix https://github.com/ruby/json/issues#issue/124 Thx to Jason Hutchens.
|
355
|
+
* Fix https://github.com/ruby/json/issues#issue/117
|
184
356
|
|
185
357
|
## 2012-01-15 (1.6.5)
|
186
358
|
* Vit Ondruch <v.ondruch@tiscali.cz> reported a bug that shows up when using
|
@@ -207,7 +379,7 @@
|
|
207
379
|
patch go to Josh Partlow (jpartlow@github).
|
208
380
|
* Improve parsing speed for JSON numbers (integers and floats) in a similar way to
|
209
381
|
what Evan Phoenix <evan@phx.io> suggested in:
|
210
|
-
https://github.com/
|
382
|
+
https://github.com/ruby/json/pull/103
|
211
383
|
|
212
384
|
## 2011-09-18 (1.6.1)
|
213
385
|
* Using -target 1.5 to force Java bits to compile with 1.5.
|
@@ -220,15 +392,14 @@
|
|
220
392
|
* Fix memory leak when used from multiple JRuby. (Patch by
|
221
393
|
jfirebaugh@github).
|
222
394
|
* Apply patch by Eric Wong <nocode@yhbt.net> that fixes garbage collection problem
|
223
|
-
reported in https://github.com/
|
395
|
+
reported in https://github.com/ruby/json/issues/46.
|
224
396
|
* Add :quirks_mode option to parser and generator.
|
225
397
|
* Add support for Rational and Complex number additions via json/add/complex
|
226
398
|
and json/add/rational requires.
|
227
399
|
|
228
400
|
## 2011-06-20 (1.5.3)
|
229
401
|
* Alias State#configure method as State#merge to increase duck type synonymy with Hash.
|
230
|
-
|
231
|
-
the new way.
|
402
|
+
* Add `as_json` methods in json/add/core, so rails can create its json objects the new way.
|
232
403
|
|
233
404
|
## 2011-05-11 (1.5.2)
|
234
405
|
* Apply documentation patch by Cory Monty <cory.monty@gmail.com>.
|
@@ -239,7 +410,7 @@
|
|
239
410
|
|
240
411
|
## 2011-01-24 (1.5.1)
|
241
412
|
* Made rake-compiler build a fat binary gem. This should fix issue
|
242
|
-
https://github.com/
|
413
|
+
https://github.com/ruby/json/issues#issue/54.
|
243
414
|
|
244
415
|
## 2011-01-22 (1.5.0)
|
245
416
|
* Included Java source codes for the Jruby extension made by Daniel Luz
|
@@ -249,7 +420,7 @@
|
|
249
420
|
reported by Riley Goodside.
|
250
421
|
|
251
422
|
## 2010-08-09 (1.4.6)
|
252
|
-
* Fixed oversight reported in http://github.com/
|
423
|
+
* Fixed oversight reported in http://github.com/ruby/json/issues/closed#issue/23,
|
253
424
|
always create a new object from the state prototype.
|
254
425
|
* Made pure and ext api more similar again.
|
255
426
|
|
@@ -259,12 +430,12 @@
|
|
259
430
|
argument.
|
260
431
|
* Some fixes in the state objects and additional tests.
|
261
432
|
## 2010-08-06 (1.4.4)
|
262
|
-
* Fixes build problem for rubinius under OS X, http://github.com/
|
263
|
-
* Fixes crashes described in http://github.com/
|
264
|
-
http://github.com/
|
433
|
+
* Fixes build problem for rubinius under OS X, http://github.com/ruby/json/issues/closed#issue/25
|
434
|
+
* Fixes crashes described in http://github.com/ruby/json/issues/closed#issue/21 and
|
435
|
+
http://github.com/ruby/json/issues/closed#issue/23
|
265
436
|
## 2010-05-05 (1.4.3)
|
266
437
|
* Fixed some test assertions, from Ruby r27587 and r27590, patch by nobu.
|
267
|
-
* Fixed issue http://github.com/
|
438
|
+
* Fixed issue http://github.com/ruby/json/issues/#issue/20 reported by
|
268
439
|
electronicwhisper@github. Thx!
|
269
440
|
|
270
441
|
## 2010-04-26 (1.4.2)
|
@@ -286,7 +457,7 @@
|
|
286
457
|
* Extension should at least be compatible with MRI, YARV and Rubinius.
|
287
458
|
|
288
459
|
## 2010-04-07 (1.2.4)
|
289
|
-
*
|
460
|
+
* Trigger const_missing callback to make Rails' dynamic class loading work.
|
290
461
|
|
291
462
|
## 2010-03-11 (1.2.3)
|
292
463
|
* Added a `State#[]` method which returns an attribute's value in order to
|