json 2.13.2 → 2.18.1
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/CHANGES.md +81 -8
- data/LEGAL +12 -0
- data/README.md +19 -1
- data/ext/json/ext/fbuffer/fbuffer.h +35 -56
- data/ext/json/ext/generator/extconf.rb +1 -1
- data/ext/json/ext/generator/generator.c +326 -264
- data/ext/json/ext/json.h +101 -0
- data/ext/json/ext/parser/extconf.rb +2 -1
- data/ext/json/ext/parser/parser.c +564 -444
- data/ext/json/ext/simd/simd.h +42 -12
- data/ext/json/ext/vendor/fpconv.c +13 -12
- data/ext/json/ext/vendor/ryu.h +819 -0
- data/lib/json/add/core.rb +1 -0
- data/lib/json/add/string.rb +35 -0
- data/lib/json/common.rb +60 -23
- data/lib/json/ext/generator/state.rb +11 -14
- data/lib/json/generic_object.rb +0 -8
- data/lib/json/truffle_ruby/generator.rb +113 -63
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +44 -1
- metadata +6 -3
data/lib/json.rb
CHANGED
|
@@ -6,6 +6,15 @@ require 'json/common'
|
|
|
6
6
|
#
|
|
7
7
|
# \JSON is a lightweight data-interchange format.
|
|
8
8
|
#
|
|
9
|
+
# \JSON is easy for us humans to read and write,
|
|
10
|
+
# and equally simple for machines to read (parse) and write (generate).
|
|
11
|
+
#
|
|
12
|
+
# \JSON is language-independent, making it an ideal interchange format
|
|
13
|
+
# for applications in differing programming languages
|
|
14
|
+
# and on differing operating systems.
|
|
15
|
+
#
|
|
16
|
+
# == \JSON Values
|
|
17
|
+
#
|
|
9
18
|
# A \JSON value is one of the following:
|
|
10
19
|
# - Double-quoted text: <tt>"foo"</tt>.
|
|
11
20
|
# - Number: +1+, +1.0+, +2.0e2+.
|
|
@@ -133,7 +142,7 @@ require 'json/common'
|
|
|
133
142
|
# When not specified:
|
|
134
143
|
# # The last value is used and a deprecation warning emitted.
|
|
135
144
|
# JSON.parse('{"a": 1, "a":2}') => {"a" => 2}
|
|
136
|
-
# #
|
|
145
|
+
# # warning: detected duplicate keys in JSON object.
|
|
137
146
|
# # This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`
|
|
138
147
|
#
|
|
139
148
|
# When set to `+true+`
|
|
@@ -173,6 +182,18 @@ require 'json/common'
|
|
|
173
182
|
# When enabled:
|
|
174
183
|
# JSON.parse('[1,]', allow_trailing_comma: true) # => [1]
|
|
175
184
|
#
|
|
185
|
+
# ---
|
|
186
|
+
#
|
|
187
|
+
# Option +allow_control_characters+ (boolean) specifies whether to allow
|
|
188
|
+
# unescaped ASCII control characters, such as newlines, in strings;
|
|
189
|
+
# defaults to +false+.
|
|
190
|
+
#
|
|
191
|
+
# With the default, +false+:
|
|
192
|
+
# JSON.parse(%{"Hello\nWorld"}) # invalid ASCII control character in string (JSON::ParserError)
|
|
193
|
+
#
|
|
194
|
+
# When enabled:
|
|
195
|
+
# JSON.parse(%{"Hello\nWorld"}, allow_control_characters: true) # => "Hello\nWorld"
|
|
196
|
+
#
|
|
176
197
|
# ====== Output Options
|
|
177
198
|
#
|
|
178
199
|
# Option +freeze+ (boolean) specifies whether the returned objects will be frozen;
|
|
@@ -307,6 +328,25 @@ require 'json/common'
|
|
|
307
328
|
#
|
|
308
329
|
# ---
|
|
309
330
|
#
|
|
331
|
+
# Option +allow_duplicate_key+ (boolean) specifies whether
|
|
332
|
+
# hashes with duplicate keys should be allowed or produce an error.
|
|
333
|
+
# defaults to emit a deprecation warning.
|
|
334
|
+
#
|
|
335
|
+
# With the default, (not set):
|
|
336
|
+
# Warning[:deprecated] = true
|
|
337
|
+
# JSON.generate({ foo: 1, "foo" => 2 })
|
|
338
|
+
# # warning: detected duplicate key "foo" in {foo: 1, "foo" => 2}.
|
|
339
|
+
# # This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`
|
|
340
|
+
# # => '{"foo":1,"foo":2}'
|
|
341
|
+
#
|
|
342
|
+
# With <tt>false</tt>
|
|
343
|
+
# JSON.generate({ foo: 1, "foo" => 2 }, allow_duplicate_key: false)
|
|
344
|
+
# # detected duplicate key "foo" in {foo: 1, "foo" => 2} (JSON::GeneratorError)
|
|
345
|
+
#
|
|
346
|
+
# In version 3.0, <tt>false</tt> will become the default.
|
|
347
|
+
#
|
|
348
|
+
# ---
|
|
349
|
+
#
|
|
310
350
|
# Option +max_nesting+ (\Integer) specifies the maximum nesting depth
|
|
311
351
|
# in +obj+; defaults to +100+.
|
|
312
352
|
#
|
|
@@ -384,6 +424,9 @@ require 'json/common'
|
|
|
384
424
|
#
|
|
385
425
|
# == \JSON Additions
|
|
386
426
|
#
|
|
427
|
+
# Note that JSON Additions must only be used with trusted data, and is
|
|
428
|
+
# deprecated.
|
|
429
|
+
#
|
|
387
430
|
# When you "round trip" a non-\String object from Ruby to \JSON and back,
|
|
388
431
|
# you have a new \String, instead of the object you began with:
|
|
389
432
|
# ruby0 = Range.new(0, 2)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.18.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: This is a JSON implementation as a Ruby extension in C.
|
|
13
13
|
email: flori@ping.de
|
|
@@ -26,12 +26,14 @@ files:
|
|
|
26
26
|
- ext/json/ext/fbuffer/fbuffer.h
|
|
27
27
|
- ext/json/ext/generator/extconf.rb
|
|
28
28
|
- ext/json/ext/generator/generator.c
|
|
29
|
+
- ext/json/ext/json.h
|
|
29
30
|
- ext/json/ext/parser/extconf.rb
|
|
30
31
|
- ext/json/ext/parser/parser.c
|
|
31
32
|
- ext/json/ext/simd/conf.rb
|
|
32
33
|
- ext/json/ext/simd/simd.h
|
|
33
34
|
- ext/json/ext/vendor/fpconv.c
|
|
34
35
|
- ext/json/ext/vendor/jeaiii-ltoa.h
|
|
36
|
+
- ext/json/ext/vendor/ryu.h
|
|
35
37
|
- json.gemspec
|
|
36
38
|
- lib/json.rb
|
|
37
39
|
- lib/json/add/bigdecimal.rb
|
|
@@ -45,6 +47,7 @@ files:
|
|
|
45
47
|
- lib/json/add/rational.rb
|
|
46
48
|
- lib/json/add/regexp.rb
|
|
47
49
|
- lib/json/add/set.rb
|
|
50
|
+
- lib/json/add/string.rb
|
|
48
51
|
- lib/json/add/struct.rb
|
|
49
52
|
- lib/json/add/symbol.rb
|
|
50
53
|
- lib/json/add/time.rb
|
|
@@ -81,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
81
84
|
- !ruby/object:Gem::Version
|
|
82
85
|
version: '0'
|
|
83
86
|
requirements: []
|
|
84
|
-
rubygems_version:
|
|
87
|
+
rubygems_version: 4.1.0.dev
|
|
85
88
|
specification_version: 4
|
|
86
89
|
summary: JSON Implementation for Ruby
|
|
87
90
|
test_files: []
|