json 2.12.2-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 249624e5c09a5dcc8065996db15ac838291cc3308cabc5f58dca5a4140f722a2
4
- data.tar.gz: 8c31dc914340ba5ebe993d0057e20562482551fd8ac7113e8a31d8de13cffdcf
3
+ metadata.gz: 7d02e010edfc6d104a71603c75a300fb9c132f306ffa4d249cd4d6c1ddb4ab43
4
+ data.tar.gz: 78ebcbd6fd0178a972b53115258f99d598f0f02b4f273b3312a906d49172c1e2
5
5
  SHA512:
6
- metadata.gz: 995dbc98b559f3db1c11d6484f0ba5737b8d2169a4907442ad7e74e5c88bf7624226353582a75e913d92973362b2b03738da830d3088f5c9dd076dd4881085dc
7
- data.tar.gz: ef8b91827b9c9d3f5707c179c551ff46d91aa36db93b075f91eea9fd67aa219aeb18f37a10c65293afbb4383d58a927f3f08373fcba1d6a19d5e663b8326e419
6
+ metadata.gz: e09b68d02973036aae449e2f44e4287be88762b408bbfe75818473b32da4306e7653ffd779bb319a9cbcbbd5ebbf49412abe2f87dbeffad0c7074739a620de14
7
+ data.tar.gz: a4fd0d769717eb4c758f3f4d4415043a4b42e3dc14f787a026e31ac89db8b1b6c5c9447c2785a19765e9643e1e1a7f2c9c0a73caf3716d930771b62f3ec43f09
data/CHANGES.md CHANGED
@@ -2,6 +2,12 @@
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
+
5
11
  ### 2025-05-23 (2.12.2)
6
12
 
7
13
  * Fix compiler optimization level.
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
- *Dir["lib/**/*.rb"],
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
- # responsability of the caller to ensure the string contains valid JSON.
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)
Binary file
Binary file
data/lib/json/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSON
4
- VERSION = '2.12.2'
4
+ VERSION = '2.13.0'
5
5
  end
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.12.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-05-23 00:00:00.000000000 Z
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