json 2.12.1-java → 2.13.0-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 +10 -0
- data/json.gemspec +2 -3
- data/lib/json/common.rb +1 -1
- 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 +33 -0
- 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: 7d02e010edfc6d104a71603c75a300fb9c132f306ffa4d249cd4d6c1ddb4ab43
|
4
|
+
data.tar.gz: 78ebcbd6fd0178a972b53115258f99d598f0f02b4f273b3312a906d49172c1e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e09b68d02973036aae449e2f44e4287be88762b408bbfe75818473b32da4306e7653ffd779bb319a9cbcbbd5ebbf49412abe2f87dbeffad0c7074739a620de14
|
7
|
+
data.tar.gz: a4fd0d769717eb4c758f3f4d4415043a4b42e3dc14f787a026e31ac89db8b1b6c5c9447c2785a19765e9643e1e1a7f2c9c0a73caf3716d930771b62f3ec43f09
|
data/CHANGES.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
### Unreleased
|
4
4
|
|
5
|
+
### 2025-05-23 (2.13.0)
|
6
|
+
|
7
|
+
* Add new `allow_duplicate_key` parsing options. By default a warning is now emitted when a duplicated key is encountered.
|
8
|
+
In `json 3.0` an error will be raised.
|
9
|
+
* Optimize parsing further using SIMD to scan strings.
|
10
|
+
|
11
|
+
### 2025-05-23 (2.12.2)
|
12
|
+
|
13
|
+
* Fix compiler optimization level.
|
14
|
+
|
5
15
|
### 2025-05-23 (2.12.1)
|
6
16
|
|
7
17
|
* Fix a potential crash in large negative floating point number generation.
|
data/json.gemspec
CHANGED
@@ -44,15 +44,14 @@ spec = Gem::Specification.new do |s|
|
|
44
44
|
"LEGAL",
|
45
45
|
"README.md",
|
46
46
|
"json.gemspec",
|
47
|
-
|
48
|
-
]
|
47
|
+
] + Dir.glob("lib/**/*.rb", base: File.expand_path("..", __FILE__))
|
49
48
|
|
50
49
|
if java_ext
|
51
50
|
s.platform = 'java'
|
52
51
|
s.files += Dir["lib/json/ext/**/*.jar"]
|
53
52
|
else
|
54
53
|
s.extensions = Dir["ext/json/**/extconf.rb"]
|
55
|
-
s.files += Dir["ext/json/**/*.{c,h}"]
|
54
|
+
s.files += Dir["ext/json/**/*.{c,h,rb}"]
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
data/lib/json/common.rb
CHANGED
@@ -268,7 +268,7 @@ module JSON
|
|
268
268
|
# to string interpolation.
|
269
269
|
#
|
270
270
|
# Note: no validation is performed on the provided string. It is the
|
271
|
-
#
|
271
|
+
# responsibility of the caller to ensure the string contains valid JSON.
|
272
272
|
Fragment = Struct.new(:json) do
|
273
273
|
def initialize(json)
|
274
274
|
unless string = String.try_convert(json)
|
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
@@ -127,6 +127,24 @@ require 'json/common'
|
|
127
127
|
#
|
128
128
|
# ---
|
129
129
|
#
|
130
|
+
# Option +allow_duplicate_key+ specifies whether duplicate keys in objects
|
131
|
+
# should be ignored or cause an error to be raised:
|
132
|
+
#
|
133
|
+
# When not specified:
|
134
|
+
# # The last value is used and a deprecation warning emitted.
|
135
|
+
# JSON.parse('{"a": 1, "a":2}') => {"a" => 2}
|
136
|
+
# # waring: detected duplicate keys in JSON object.
|
137
|
+
# # This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`
|
138
|
+
#
|
139
|
+
# When set to `+true+`
|
140
|
+
# # The last value is used.
|
141
|
+
# JSON.parse('{"a": 1, "a":2}') => {"a" => 2}
|
142
|
+
#
|
143
|
+
# When set to `+false+`, the future default:
|
144
|
+
# JSON.parse('{"a": 1, "a":2}') => duplicate key at line 1 column 1 (JSON::ParserError)
|
145
|
+
#
|
146
|
+
# ---
|
147
|
+
#
|
130
148
|
# Option +allow_nan+ (boolean) specifies whether to allow
|
131
149
|
# NaN, Infinity, and MinusInfinity in +source+;
|
132
150
|
# defaults to +false+.
|
@@ -143,8 +161,23 @@ require 'json/common'
|
|
143
161
|
# ruby = JSON.parse(source, {allow_nan: true})
|
144
162
|
# ruby # => [NaN, Infinity, -Infinity]
|
145
163
|
#
|
164
|
+
# ---
|
165
|
+
#
|
166
|
+
# Option +allow_trailing_comma+ (boolean) specifies whether to allow
|
167
|
+
# trailing commas in objects and arrays;
|
168
|
+
# defaults to +false+.
|
169
|
+
#
|
170
|
+
# With the default, +false+:
|
171
|
+
# JSON.parse('[1,]') # unexpected character: ']' at line 1 column 4 (JSON::ParserError)
|
172
|
+
#
|
173
|
+
# When enabled:
|
174
|
+
# JSON.parse('[1,]', allow_trailing_comma: true) # => [1]
|
175
|
+
#
|
146
176
|
# ====== Output Options
|
147
177
|
#
|
178
|
+
# Option +freeze+ (boolean) specifies whether the returned objects will be frozen;
|
179
|
+
# defaults to +false+.
|
180
|
+
#
|
148
181
|
# Option +symbolize_names+ (boolean) specifies whether returned \Hash keys
|
149
182
|
# should be Symbols;
|
150
183
|
# defaults to +false+ (use Strings).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Daniel Luz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A JSON implementation as a JRuby extension.
|
14
14
|
email: dev+ruby@mernen.com
|