json 3.0.0.rc1-java → 3.0.2-java
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 +15 -2
- data/lib/json/common.rb +76 -19
- data/lib/json/ext/generator.jar +0 -0
- data/lib/json/ext/parser.jar +0 -0
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +37 -37
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4be775fd0d4221af4703313be47b36df730b542f95063025472d82386bc6f949
|
|
4
|
+
data.tar.gz: aa1136bf72ebb55174ab30a3ddcaf908364a7e0cde743b952435a5ab59195d0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b1da37df8ae7d0a8a40e41caed988f2b9f33c8ef147e66220e811adbc26199482189055badf0023bc5c4b8f201f2954a30cfa355cd7629604485c0424869f06
|
|
7
|
+
data.tar.gz: 7e50467d636c6a30b701d4778650355e6856660add1de37eef2519865977107e715cf19d3bcceff288ee068b5993908535243b6b799f7bc37bd7f41b8c270d37
|
data/CHANGES.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
### Unreleased
|
|
4
4
|
|
|
5
|
+
### 2026-09-09 (3.0.2)
|
|
6
|
+
|
|
7
|
+
* Fix `JSON.load_file` and `JSON.load_file!` to load on Ruby 2.7.0 through 2.7.2, which cannot parse a leading parameter before `...`.
|
|
8
|
+
|
|
9
|
+
### 2026-09-08 (3.0.1)
|
|
10
|
+
|
|
11
|
+
* Restore the `limit` positional argument of `JSON.dump`.
|
|
12
|
+
|
|
13
|
+
### 2026-09-07 (3.0.0)
|
|
14
|
+
|
|
15
|
+
* Add `JSON::ParserError#json_path` to locate parse errors in the document as a JSONPath-style string (e.g. `$.foo[0].bar`). For duplicate key errors it points at the duplicated key itself.
|
|
16
|
+
* Fix the parser to also reject lone trailing UTF-16 surrogates (`\uDCxx` with no leading partner), symmetric to the leading-surrogate case. The Java parser already rejected these; this closes the CRuby/JRuby parity gap.
|
|
17
|
+
|
|
5
18
|
### 2026-08-11 (3.0.0.rc1)
|
|
6
19
|
|
|
7
20
|
With the removal of the insecure `create_additions` option, `JSON.load` and `JSON.dump` are
|
|
@@ -24,8 +37,8 @@ JavaScript comments in documents are no longer supported by default.
|
|
|
24
37
|
Numerous rarely used aliases have been removed.
|
|
25
38
|
|
|
26
39
|
* `JSON.load` defaults are now safe to use.
|
|
27
|
-
* All unknown options
|
|
28
|
-
* The `allow_comments` parsing option now
|
|
40
|
+
* All unknown options will now cause an `ArgumentError` rather than to be ignored.
|
|
41
|
+
* The `allow_comments` parsing option now defaults to `false`.
|
|
29
42
|
* The `allow_duplicate_key` option now defaults to `false`, for both parsing and generating JSON.
|
|
30
43
|
* Removed the `limit` positional argument of `JSON.dump`.
|
|
31
44
|
* Removed the `escape_slash` alias of `script_safe`.
|
data/lib/json/common.rb
CHANGED
|
@@ -142,7 +142,56 @@ module JSON
|
|
|
142
142
|
|
|
143
143
|
# This exception is raised if a parser error occurs.
|
|
144
144
|
class ParserError < JSONError
|
|
145
|
-
|
|
145
|
+
# Line number where the parser encountered an error.
|
|
146
|
+
# Is +nil+ when raised by JSON::ResumableParser.
|
|
147
|
+
attr_reader :line
|
|
148
|
+
|
|
149
|
+
# Column number where the parser encountered an error.
|
|
150
|
+
# Is +nil+ when raised by JSON::ResumableParser.
|
|
151
|
+
attr_reader :column
|
|
152
|
+
|
|
153
|
+
# Returns a best effort JSONPath string representing where in the document
|
|
154
|
+
# the parser encountered an error:
|
|
155
|
+
#
|
|
156
|
+
# begin
|
|
157
|
+
# JSON.parse('{"articles": [ { "title": invalid } ]}')
|
|
158
|
+
# rescue JSON::ParserError => error
|
|
159
|
+
# error.json_path # => "$.articles[0].title"
|
|
160
|
+
# end
|
|
161
|
+
def json_path
|
|
162
|
+
return @json_path if String === @json_path
|
|
163
|
+
|
|
164
|
+
if Array === @json_path
|
|
165
|
+
path = build_json_path(@json_path)
|
|
166
|
+
@json_path = path unless frozen?
|
|
167
|
+
return path
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
private
|
|
172
|
+
|
|
173
|
+
def build_json_path(segments)
|
|
174
|
+
error = false
|
|
175
|
+
path = segments.filter_map do |segment|
|
|
176
|
+
next if error
|
|
177
|
+
|
|
178
|
+
case segment
|
|
179
|
+
when Integer
|
|
180
|
+
"[#{segment}]"
|
|
181
|
+
when String, Symbol
|
|
182
|
+
if segment.match?(/\A[a-zA-Z\$\_][a-zA-Z\$\_0-9]*\z/)
|
|
183
|
+
".#{segment}"
|
|
184
|
+
else
|
|
185
|
+
segment = segment.to_s.gsub(/["\\]/, { '"' => '\\"', '\\' => '\\\\' })
|
|
186
|
+
%{["#{segment}"]}
|
|
187
|
+
end
|
|
188
|
+
else
|
|
189
|
+
error = true
|
|
190
|
+
nil
|
|
191
|
+
end
|
|
192
|
+
end.join
|
|
193
|
+
"$#{path}".freeze
|
|
194
|
+
end
|
|
146
195
|
end
|
|
147
196
|
|
|
148
197
|
# This exception is raised if the nesting of parsed data structures is too
|
|
@@ -241,7 +290,7 @@ module JSON
|
|
|
241
290
|
# ---
|
|
242
291
|
#
|
|
243
292
|
# Raises an exception if +source+ is not valid JSON:
|
|
244
|
-
# # Raises JSON::ParserError unexpected character: 'invalid' at line 1 column 1
|
|
293
|
+
# # Raises JSON::ParserError (unexpected character: 'invalid' at line 1 column 1):
|
|
245
294
|
# JSON.parse('invalid')
|
|
246
295
|
#
|
|
247
296
|
def parse(source, on_load: nil, object_class: nil, array_class: nil, **options)
|
|
@@ -275,8 +324,8 @@ module JSON
|
|
|
275
324
|
# parse(File.read(path), **)
|
|
276
325
|
#
|
|
277
326
|
# See method #parse.
|
|
278
|
-
def load_file(filespec,
|
|
279
|
-
parse(File.read(filespec, encoding: Encoding::UTF_8),
|
|
327
|
+
def load_file(filespec, **options)
|
|
328
|
+
parse(File.read(filespec, encoding: Encoding::UTF_8), **options)
|
|
280
329
|
end
|
|
281
330
|
|
|
282
331
|
# :call-seq:
|
|
@@ -286,8 +335,8 @@ module JSON
|
|
|
286
335
|
# JSON.parse!(File.read(path), **)
|
|
287
336
|
#
|
|
288
337
|
# See method #parse!
|
|
289
|
-
def load_file!(filespec,
|
|
290
|
-
parse!(File.read(filespec, encoding: Encoding::UTF_8),
|
|
338
|
+
def load_file!(filespec, **options)
|
|
339
|
+
parse!(File.read(filespec, encoding: Encoding::UTF_8), **options)
|
|
291
340
|
end
|
|
292
341
|
|
|
293
342
|
# :call-seq:
|
|
@@ -323,7 +372,7 @@ module JSON
|
|
|
323
372
|
#
|
|
324
373
|
# Raises an exception if +obj+ contains circular references:
|
|
325
374
|
# a = []; b = []; a.push(b); b.push(a)
|
|
326
|
-
# # Raises JSON::NestingError (nesting of 100 is too deep):
|
|
375
|
+
# # Raises JSON::NestingError (nesting of 100 is too deep. Did you try to serialize objects with circular references?):
|
|
327
376
|
# JSON.generate(a)
|
|
328
377
|
#
|
|
329
378
|
def generate(obj, opts = nil)
|
|
@@ -677,16 +726,14 @@ module JSON
|
|
|
677
726
|
end
|
|
678
727
|
|
|
679
728
|
# :call-seq:
|
|
680
|
-
# JSON.dump(obj, io = nil, options = nil)
|
|
729
|
+
# JSON.dump(obj, io = nil, _deprecated_limit = nil, options = nil)
|
|
681
730
|
#
|
|
682
731
|
# Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
|
|
683
732
|
#
|
|
684
|
-
# The default options can be changed via method JSON.dump_default_options.
|
|
685
|
-
#
|
|
686
733
|
# - Argument +io+, if given, should respond to method +write+;
|
|
687
734
|
# the \JSON \String is written to +io+, and +io+ is returned.
|
|
688
735
|
# If +io+ is not given, the \JSON \String is returned.
|
|
689
|
-
#
|
|
736
|
+
# - Argument +_deprecated_limit+ is deprecated, pass the +:max_nesting+ option instead.
|
|
690
737
|
# ---
|
|
691
738
|
#
|
|
692
739
|
# When argument +io+ is not given, returns the \JSON \String generated from +obj+:
|
|
@@ -702,21 +749,31 @@ module JSON
|
|
|
702
749
|
# puts File.read(path)
|
|
703
750
|
# Output:
|
|
704
751
|
# {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
|
|
705
|
-
def dump(obj, anIO = nil, kwargs = nil)
|
|
752
|
+
def dump(obj, anIO = nil, _deprecated_limit = nil, kwargs = nil)
|
|
706
753
|
if kwargs.nil?
|
|
707
|
-
if
|
|
708
|
-
|
|
709
|
-
|
|
754
|
+
if _deprecated_limit.nil?
|
|
755
|
+
if anIO.is_a?(Hash)
|
|
756
|
+
kwargs = anIO
|
|
757
|
+
anIO = nil
|
|
758
|
+
end
|
|
759
|
+
elsif _deprecated_limit.is_a?(Hash)
|
|
760
|
+
kwargs = _deprecated_limit
|
|
761
|
+
_deprecated_limit = nil
|
|
710
762
|
end
|
|
711
763
|
end
|
|
712
764
|
|
|
713
|
-
|
|
714
|
-
|
|
765
|
+
unless anIO.nil?
|
|
766
|
+
if anIO.respond_to?(:to_io)
|
|
767
|
+
anIO = anIO.to_io
|
|
768
|
+
elsif _deprecated_limit.nil? && !anIO.respond_to?(:write)
|
|
769
|
+
anIO, _deprecated_limit = nil, anIO
|
|
770
|
+
end
|
|
715
771
|
end
|
|
716
772
|
|
|
717
773
|
opts = {
|
|
718
774
|
allow_nan: true,
|
|
719
775
|
}
|
|
776
|
+
opts[:max_nesting] = _deprecated_limit if _deprecated_limit
|
|
720
777
|
opts.merge!(kwargs) if kwargs
|
|
721
778
|
|
|
722
779
|
State.generate(obj, opts, anIO)
|
|
@@ -755,9 +812,9 @@ module JSON
|
|
|
755
812
|
private_constant :EXCLUDED_GENERATOR_OPTIONS
|
|
756
813
|
|
|
757
814
|
# :call-seq:
|
|
758
|
-
# JSON.new(options
|
|
815
|
+
# JSON::Coder.new(**options, &block)
|
|
759
816
|
#
|
|
760
|
-
#
|
|
817
|
+
# Keyword arguments +options+, if given, are options for both parsing and generating.
|
|
761
818
|
# See {Parsing Options}[rdoc-ref:JSON@Parsing+Options],
|
|
762
819
|
# and {Generating Options}[rdoc-ref:JSON@Generating+Options].
|
|
763
820
|
#
|
data/lib/json/ext/generator.jar
CHANGED
|
Binary file
|
data/lib/json/ext/parser.jar
CHANGED
|
Binary file
|
data/lib/json/version.rb
CHANGED
data/lib/json.rb
CHANGED
|
@@ -44,13 +44,13 @@ require 'json/common'
|
|
|
44
44
|
#
|
|
45
45
|
# You can parse a \String containing \JSON data using
|
|
46
46
|
# either of two methods:
|
|
47
|
-
# - <tt>JSON.parse(source, opts)</tt>
|
|
48
|
-
# - <tt>JSON.parse!(source, opts)</tt>
|
|
47
|
+
# - <tt>JSON.parse(source, **opts)</tt>
|
|
48
|
+
# - <tt>JSON.parse!(source, **opts)</tt>
|
|
49
49
|
#
|
|
50
50
|
# where
|
|
51
51
|
# - +source+ is a Ruby object.
|
|
52
|
-
# - +opts+
|
|
53
|
-
#
|
|
52
|
+
# - +opts+ are keyword arguments that control both input
|
|
53
|
+
# allowed and output formatting.
|
|
54
54
|
#
|
|
55
55
|
# The difference between the two methods
|
|
56
56
|
# is that JSON.parse! omits some checks
|
|
@@ -102,7 +102,7 @@ require 'json/common'
|
|
|
102
102
|
# ruby # => 1.0
|
|
103
103
|
# ruby.class # => Float
|
|
104
104
|
# ruby = JSON.parse('2.0e2')
|
|
105
|
-
# ruby # => 200
|
|
105
|
+
# ruby # => 200.0
|
|
106
106
|
# ruby.class # => Float
|
|
107
107
|
# Boolean:
|
|
108
108
|
# ruby = JSON.parse('true')
|
|
@@ -131,10 +131,10 @@ require 'json/common'
|
|
|
131
131
|
# ruby # => [0, [1, [2, [3]]]]
|
|
132
132
|
# Too deep:
|
|
133
133
|
# # Raises JSON::NestingError (nesting of 2 is too deep):
|
|
134
|
-
# JSON.parse(source,
|
|
134
|
+
# JSON.parse(source, max_nesting: 1)
|
|
135
135
|
# Bad value:
|
|
136
|
-
# # Raises TypeError (
|
|
137
|
-
# JSON.parse(source,
|
|
136
|
+
# # Raises TypeError (no implicit conversion of Symbol into Integer):
|
|
137
|
+
# JSON.parse(source, max_nesting: :foo)
|
|
138
138
|
#
|
|
139
139
|
# ---
|
|
140
140
|
#
|
|
@@ -142,11 +142,11 @@ require 'json/common'
|
|
|
142
142
|
# should be ignored or cause an error to be raised:
|
|
143
143
|
#
|
|
144
144
|
# When set to +false+, the default:
|
|
145
|
-
# JSON.parse('{"a": 1, "a":2}')
|
|
145
|
+
# JSON.parse('{"a": 1, "a": 2}') # duplicate key "a" at line 1 column 1 (JSON::ParserError)
|
|
146
146
|
#
|
|
147
147
|
# When set to +true+:
|
|
148
148
|
# # The last value is used.
|
|
149
|
-
# JSON.parse('{"a": 1, "a":2}', allow_duplicate_key: true) => {"a" => 2}
|
|
149
|
+
# JSON.parse('{"a": 1, "a": 2}', allow_duplicate_key: true) # => {"a" => 2}
|
|
150
150
|
#
|
|
151
151
|
# ---
|
|
152
152
|
#
|
|
@@ -155,15 +155,15 @@ require 'json/common'
|
|
|
155
155
|
# defaults to +false+.
|
|
156
156
|
#
|
|
157
157
|
# With the default, +false+:
|
|
158
|
-
# # Raises JSON::ParserError (
|
|
158
|
+
# # Raises JSON::ParserError (unexpected token 'NaN]' at line 1 column 2):
|
|
159
159
|
# JSON.parse('[NaN]')
|
|
160
|
-
# # Raises JSON::ParserError (
|
|
160
|
+
# # Raises JSON::ParserError (unexpected token 'Infinity]' at line 1 column 2):
|
|
161
161
|
# JSON.parse('[Infinity]')
|
|
162
|
-
# # Raises JSON::ParserError (
|
|
162
|
+
# # Raises JSON::ParserError (invalid number: '-Infinity]' at line 1 column 2):
|
|
163
163
|
# JSON.parse('[-Infinity]')
|
|
164
164
|
# Allow:
|
|
165
165
|
# source = '[NaN, Infinity, -Infinity]'
|
|
166
|
-
# ruby = JSON.parse(source,
|
|
166
|
+
# ruby = JSON.parse(source, allow_nan: true)
|
|
167
167
|
# ruby # => [NaN, Infinity, -Infinity]
|
|
168
168
|
#
|
|
169
169
|
# ---
|
|
@@ -185,10 +185,10 @@ require 'json/common'
|
|
|
185
185
|
# defaults to +false+.
|
|
186
186
|
#
|
|
187
187
|
# When set to +false+, the default:
|
|
188
|
-
# JSON.parse('/* comment */ {"a": 1, "a":2}') # unexpected
|
|
188
|
+
# JSON.parse('/* comment */ {"a": 1, "a": 2}') # unexpected token '/*' at line 1 column 1 (JSON::ParserError)
|
|
189
189
|
#
|
|
190
190
|
# When set to +true+, comments are ignored:
|
|
191
|
-
# JSON.parse('/* comment */ {"a": 1
|
|
191
|
+
# JSON.parse('/* comment */ {"a": 1} // more comment', allow_comments: true) # => {"a" => 1}
|
|
192
192
|
#
|
|
193
193
|
# ---
|
|
194
194
|
#
|
|
@@ -197,7 +197,7 @@ require 'json/common'
|
|
|
197
197
|
# defaults to +false+.
|
|
198
198
|
#
|
|
199
199
|
# With the default, +false+:
|
|
200
|
-
# JSON.parse(%{"Hello\nWorld"}) # invalid ASCII control character in string (JSON::ParserError)
|
|
200
|
+
# JSON.parse(%{"Hello\nWorld"}) # invalid ASCII control character in string: \nWorld" at line 2 column 0 (JSON::ParserError)
|
|
201
201
|
#
|
|
202
202
|
# When enabled:
|
|
203
203
|
# JSON.parse(%{"Hello\nWorld"}, allow_control_characters: true) # => "Hello\nWorld"
|
|
@@ -209,7 +209,7 @@ require 'json/common'
|
|
|
209
209
|
# defaults to +false+.
|
|
210
210
|
#
|
|
211
211
|
# With the default, +false+:
|
|
212
|
-
# JSON.parse('"Hell\o"') # invalid escape character in string (JSON::ParserError)
|
|
212
|
+
# JSON.parse('"Hell\o"') # invalid escape character in string: '\o"' at line 1 column 6 (JSON::ParserError)
|
|
213
213
|
#
|
|
214
214
|
# When enabled:
|
|
215
215
|
# JSON.parse('"Hell\o"', allow_invalid_escape: true) # => "Hello"
|
|
@@ -228,8 +228,8 @@ require 'json/common'
|
|
|
228
228
|
# ruby = JSON.parse(source)
|
|
229
229
|
# ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
|
|
230
230
|
# Use Symbols:
|
|
231
|
-
# ruby = JSON.parse(source,
|
|
232
|
-
# ruby # => {:
|
|
231
|
+
# ruby = JSON.parse(source, symbolize_names: true)
|
|
232
|
+
# ruby # => {a: "foo", b: 1.0, c: true, d: false, e: nil}
|
|
233
233
|
#
|
|
234
234
|
# ---
|
|
235
235
|
#
|
|
@@ -242,7 +242,7 @@ require 'json/common'
|
|
|
242
242
|
# ruby = JSON.parse(source)
|
|
243
243
|
# ruby.class # => Hash
|
|
244
244
|
# Use class \OpenStruct:
|
|
245
|
-
# ruby = JSON.parse(source,
|
|
245
|
+
# ruby = JSON.parse(source, object_class: OpenStruct)
|
|
246
246
|
# ruby # => #<OpenStruct a="foo", b=1.0, c=true, d=false, e=nil>
|
|
247
247
|
#
|
|
248
248
|
# ---
|
|
@@ -256,8 +256,8 @@ require 'json/common'
|
|
|
256
256
|
# ruby = JSON.parse(source)
|
|
257
257
|
# ruby.class # => Array
|
|
258
258
|
# Use class \Set:
|
|
259
|
-
# ruby = JSON.parse(source,
|
|
260
|
-
# ruby # =>
|
|
259
|
+
# ruby = JSON.parse(source, array_class: Set)
|
|
260
|
+
# ruby # => Set["foo", 1.0, true, false, nil]
|
|
261
261
|
#
|
|
262
262
|
# === Generating \JSON
|
|
263
263
|
#
|
|
@@ -319,22 +319,22 @@ require 'json/common'
|
|
|
319
319
|
# a \String containing a \JSON string representation of the source:
|
|
320
320
|
# JSON.generate(:foo) # => '"foo"'
|
|
321
321
|
# JSON.generate(Complex(0, 0)) # => '"0+0i"'
|
|
322
|
-
# JSON.generate(Dir.new('.')) # => '"#<Dir
|
|
322
|
+
# JSON.generate(Dir.new('.')) # => '"#<Dir:0x...>"'
|
|
323
323
|
#
|
|
324
324
|
# ==== Generating Options
|
|
325
325
|
#
|
|
326
326
|
# ====== Input Options
|
|
327
327
|
#
|
|
328
328
|
# Option +allow_nan+ (boolean) specifies whether
|
|
329
|
-
# +NaN+, +Infinity+, and
|
|
329
|
+
# +NaN+, +Infinity+, and +-Infinity+ may be generated;
|
|
330
330
|
# defaults to +false+.
|
|
331
331
|
#
|
|
332
332
|
# With the default, +false+:
|
|
333
|
-
# # Raises JSON::GeneratorError (
|
|
333
|
+
# # Raises JSON::GeneratorError (NaN not allowed in JSON):
|
|
334
334
|
# JSON.generate(JSON::NaN)
|
|
335
|
-
# # Raises JSON::GeneratorError (
|
|
335
|
+
# # Raises JSON::GeneratorError (Infinity not allowed in JSON):
|
|
336
336
|
# JSON.generate(JSON::Infinity)
|
|
337
|
-
# # Raises JSON::GeneratorError (
|
|
337
|
+
# # Raises JSON::GeneratorError (-Infinity not allowed in JSON):
|
|
338
338
|
# JSON.generate(JSON::MinusInfinity)
|
|
339
339
|
#
|
|
340
340
|
# Allow:
|
|
@@ -345,14 +345,14 @@ require 'json/common'
|
|
|
345
345
|
#
|
|
346
346
|
# Option +allow_duplicate_key+ (boolean) specifies whether
|
|
347
347
|
# hashes with duplicate keys should be allowed or produce an error.
|
|
348
|
-
#
|
|
348
|
+
# Defaults to +false+, which raises an error.
|
|
349
349
|
#
|
|
350
|
-
# With the default,
|
|
351
|
-
# JSON.generate({
|
|
350
|
+
# With the default, +false+:
|
|
351
|
+
# JSON.generate({foo: 1, "foo" => 2})
|
|
352
352
|
# # detected duplicate key "foo" in {foo: 1, "foo" => 2} (JSON::GeneratorError)
|
|
353
353
|
#
|
|
354
|
-
# With
|
|
355
|
-
# JSON.generate({
|
|
354
|
+
# With +true+:
|
|
355
|
+
# JSON.generate({foo: 1, "foo" => 2}, allow_duplicate_key: true)
|
|
356
356
|
# # => '{"foo":1,"foo":2}'
|
|
357
357
|
#
|
|
358
358
|
# ---
|
|
@@ -365,13 +365,13 @@ require 'json/common'
|
|
|
365
365
|
# JSON.generate(obj) # => '[[[[[[0]]]]]]'
|
|
366
366
|
#
|
|
367
367
|
# Too deep:
|
|
368
|
-
# # Raises JSON::NestingError (nesting of 2 is too deep):
|
|
368
|
+
# # Raises JSON::NestingError (nesting of 2 is too deep. Did you try to serialize objects with circular references?):
|
|
369
369
|
# JSON.generate(obj, max_nesting: 2)
|
|
370
370
|
#
|
|
371
371
|
# With +false+:
|
|
372
372
|
# obj = []
|
|
373
373
|
# obj[0] = obj
|
|
374
|
-
# # Raises
|
|
374
|
+
# # Raises SystemStackError (stack level too deep):
|
|
375
375
|
# JSON.generate(obj, max_nesting: false)
|
|
376
376
|
#
|
|
377
377
|
# Setting +max_nesting+ to +false+ or a very large number can lead to a stack overflow
|
|
@@ -410,7 +410,7 @@ require 'json/common'
|
|
|
410
410
|
# inserted before the colon in each \JSON object's pair;
|
|
411
411
|
# defaults to the empty \String, <tt>''</tt>.
|
|
412
412
|
# - Option +sort_keys+ (boolean or \Proc) controls whether and how the keys of a
|
|
413
|
-
# hash are sorted when generating the output; defaults to
|
|
413
|
+
# hash are sorted when generating the output; defaults to +false+.
|
|
414
414
|
# When +true+, keys are sorted lexicographically. When a \Proc, it receives
|
|
415
415
|
# the entire \Hash and must return a \Hash with its pairs in the desired
|
|
416
416
|
# order, allowing for arbitrary sort orders.
|
|
@@ -439,7 +439,7 @@ require 'json/common'
|
|
|
439
439
|
# "foo" : [
|
|
440
440
|
# "bar",
|
|
441
441
|
# "baz"
|
|
442
|
-
#
|
|
442
|
+
# ],
|
|
443
443
|
# "bat" : {
|
|
444
444
|
# "bam" : 0,
|
|
445
445
|
# "bad" : 1
|
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: 3.0.
|
|
4
|
+
version: 3.0.2
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Luz
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-09-09 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: A JSON implementation as a JRuby extension.
|
|
13
13
|
email: dev+ruby@mernen.com
|