285 Commits
Author SHA1 Message Date
Sebastian Turner 63ae538ecf [ruby/json] Fix ParserError#json_path with symbolize_names: true
Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>

https://github.com/ruby/json/commit/c839870678
2026-10-19 16:25:24 +00:00
Jean Boussier 53e7d061f9 [ruby/json] Release 3.1.0
https://github.com/ruby/json/commit/a15b2ba603
2026-10-13 08:04:57 +00:00
Jean Boussier 72afd0b0d9 [ruby/json] Refactor rfc8785_sort_keys_proc
https://github.com/ruby/json/commit/d09e383d19
2026-10-13 07:32:24 +00:00
Jean Boussier ad29ad7ad8 [ruby/json] Handle invalid encoding in JSON path keys
https://github.com/ruby/json/commit/e19f7d75a6
2026-10-12 14:55:31 +00:00
ydah dbd87dcc28 [ruby/json] Sort RFC 8785 keys after as_json conversion
https://github.com/ruby/json/commit/88b358d8b2
2026-10-12 07:15:16 +00:00
ydah 95db6abe45 [ruby/json] Reject incompatible RFC 8785 generation options
https://github.com/ruby/json/commit/49e8df0e16
2026-10-08 09:57:55 +00:00
ydah 87c567e721 [ruby/json] Canonicalize integers as doubles in RFC 8785 mode
https://github.com/ruby/json/commit/3d9d6dd32d
2026-10-08 07:05:47 +00:00
ydah 9d46512aab [ruby/json] Fix RFC 8785 number formatter spelling
https://github.com/ruby/json/commit/3e3807c82a
2026-10-07 14:36:49 +00:00
ydah 432e0dc577 [ruby/json] Sort RFC 8785 object properties by their keys
https://github.com/ruby/json/commit/808577ae1d
2026-10-07 14:36:31 +00:00
ydah 1ebc88b530 [ruby/json] Preserve float precision in RFC 8785 number formatting
https://github.com/ruby/json/commit/193df55852
2026-10-07 13:03:24 +00:00
ydah 2c1e694a53 [ruby/json] Exclude custom instance variables from State#to_h
https://github.com/ruby/json/commit/08e72297b2
2026-10-05 15:26:55 +00:00
ydah 156c095332 [ruby/json] Honor as_json and reject disabled strict mode in JSON::Coder
https://github.com/ruby/json/commit/b63b4f1506
2026-10-05 13:45:41 +00:00
Jean Boussier 6930c20b65 [ruby/json] Implement rfc8785
Fix: https://github.com/ruby/json/issues/1038

Directly lift https://github.com/dryruby/json-canonicalization

At least for now, implementing most of the logic in Ruby make it
shareable between the 3 generator implementations, largely reducing
the maintenance cost.

I don't particularly expect canonicalization to be a hotspot,
but if it happens to be, I'd be open to specialize the implementation,
within reason, at least in the C generator.

https://github.com/ruby/json/commit/f103c8953f
2026-10-02 14:45:31 +00:00
ydah 8cf3b6691f [ruby/json] Fix parser error positions for newlines and multibyte characters
https://github.com/ruby/json/commit/590dd5448d
2026-10-02 13:03:45 +00:00
ydah 05479caf57 [ruby/json] Remove the leading space from Fragment conversion errors
https://github.com/ruby/json/commit/0c46c27fae
2026-10-01 07:15:23 +00:00
Lucas Dohmen 7da1b1c7a0 [ruby/json] Fix Interoperability with Zlib::GzipReader
GzipReader offers both a read and to_io method. The read method returns
the uncompressed file as a string. The to_io method returns the
compressed file. The JSON.load method first tests for the to_io method
and uses it before testing for the read method. This results in reading
the compressed file, which is invalid JSON.

Instead, we now test for the read method first.

https://github.com/ruby/json/commit/b6a5d35245
2026-09-30 13:46:09 +00:00
Jean Boussier 5fe7d61b20 [ruby/json] Ensure default_sort_keys_proc isn't reassigned.
It's assignable from Ruby simply for the gem's own initialization,
but it should never be re-assigned later.

Fix: https://github.com/ruby/json/pull/1079

https://github.com/ruby/json/commit/cc32ef5cf5
2026-09-28 18:59:04 +02:00
Matt Valentine-House 43b1e17d08 json: reject non-shareable default sort_keys proc from non-main Ractors
JSON::State.default_sort_keys_proc is registered at extension load time
so it's owned by the main Ractor.

When we implement the registration table on each Ractor storing another
Ractor's unshareable Proc into that slot leaves a dangling reference
when the owning Ractor runs a local GC.

This commit ensures that we won't use a shareable proc by raising a
Ractor::IsolationError.
2026-09-25 19:24:10 +01:00
Jean Boussier 344fa79bc6 [ruby/json] Release 3.0.2
https://github.com/ruby/json/commit/7b2a23deea
2026-09-09 06:24:00 +00:00
Douglas Eichelberger 967e607789 [ruby/json] Fix the JSON::Coder.new call-seq
`JSON` has no `.new`, and options have been keyword arguments since 3.0,
so passing a positional Hash raises ArgumentError.

https://github.com/ruby/json/commit/effca27964
2026-09-09 06:21:57 +00:00
Benjamin Quorning 83185d33c4 [ruby/json] Update documentation to match json 3.0 API
json 3.0 changed `JSON.parse` to take keyword arguments instead of a
positional opts Hash, so some of the documented usage would now raise
`ArgumentError`. I have updated all such examples to use kwargs instead.

Also align documented output with what is actually produced with the
current parser/generator on Ruby 4.0, plus a number of other minor
changes.

https://github.com/ruby/json/commit/8bdd5179df
2026-09-08 15:56:53 +00:00
Koichi ITO 847c5ce1ac [ruby/json] Fix JSON.load_file and JSON.load_file! to load on Ruby 2.7.0 through 2.7.2
Since https://github.com/ruby/json/commit/ebf0f29, `load_file` and `load_file!` forward their arguments to
`parse` and `parse!` with `...` after a leading parameter. Ruby 2.7 accepts `...` only on its own;
a leading parameter before it was added in Ruby 3.0 and reached the 2.7 series in 2.7.3, so on Ruby 2.7.0
through 2.7.2 requiring json 3.0 raises a `SyntaxError` at `lib/json/common.rb`, while the gemspec still allows
Ruby 2.7 as a whole.

`parse` and `parse!` take keyword arguments only, so forwarding `**options` passes exactly what `...` passed,
on every Ruby the gem supports.

A `method_missing` helper in the parser tests used the same form; it takes an anonymous splat now,
so the test suite itself loads on those versions.

Checked with `ruby -c` on Ruby 2.7.0, 2.7.2, 2.7.3, and 3.0.7, and with the test suite on Ruby 2.7.2 and 3.0.7.

https://github.com/ruby/json/commit/29dad14674
2026-09-08 10:42:56 +00:00
Jean Boussier 78963e69a3 [ruby/json] Release 3.0.1
https://github.com/ruby/json/commit/c557a62719
2026-09-08 07:09:17 +00:00
Jean Boussier d98d7978dc [ruby/json] Restore the limit positional argument of JSON.dump
I really wanted to get rid of this because the argument parsing is
awful and costly.

But `rdoc` has been using this positional argument for decades,
and while the fix has been merged, having to upgrade to the latest
rdoc is a bit too disruptive.

https://github.com/ruby/json/commit/566bd7c108
2026-09-08 07:06:44 +00:00
Jean Boussier 3ade997abe [ruby/json] Release 3.0.0
https://github.com/ruby/json/commit/9427d36671
2026-09-07 06:57:12 +00:00
Ojus ChughandJean Boussier 065a5592d2 [ruby/json] Add JSON::ParserError#json_path
(https://github.com/ruby/json/pull/1062)

Add JSON::ParserError#json_path

https://github.com/ruby/json/commit/9ae76bdd3d

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2026-08-24 15:04:10 +00:00
Jean Boussier f51515f39a [ruby/json] Relase 3.0.0.rc1
https://github.com/ruby/json/commit/4f89162e8b
2026-08-11 08:12:52 +00:00
Jean Boussier 0e63aec18f [ruby/json] Prepare 3.x release notes
https://github.com/ruby/json/commit/7924498395
2026-08-11 08:12:52 +00:00
Jean Boussier fe6bb69c82 [ruby/json] Get rid of JSON::JSON_LOADED
https://github.com/ruby/json/commit/4816cab109
2026-08-11 08:12:52 +00:00
Jean Boussier ac60d4ae4d [ruby/json] Make generator options strict
https://github.com/ruby/json/commit/a8d7f6da6b
2026-08-11 08:12:51 +00:00
Jean Boussier e79dd68040 [ruby/json] Make parsing options keyword arguments
Or at least behave like them.

https://github.com/ruby/json/commit/ebf0f2901c
2026-08-11 08:12:50 +00:00
Jean Boussier 86d92b7fed [ruby/json] Remove the limit positional argument of JSON.dump.
It's entirely redundant with `max_nesting`, makes little sense
except to match Marshal signature exactly, but I don't see the
point.

https://github.com/ruby/json/commit/6e668d2cfe
2026-08-11 08:12:50 +00:00
Jean Boussier aac310d257 [ruby/json] Remove JSON::GenericObject
https://github.com/ruby/json/commit/273b38d8f4
2026-08-11 08:12:50 +00:00
Jean Boussier 92fee2a3f5 [ruby/json] Remove JSON.fast_generate
https://github.com/ruby/json/commit/e93e5d645e
2026-08-11 08:12:50 +00:00
Jean Boussier 87dbb3821d [ruby/json] Remove create_additions option
https://github.com/ruby/json/commit/1f65fe1c2d
2026-08-11 08:12:50 +00:00
Jean Boussier 75e34faee5 [ruby/json] Remove PRETTY_STATE_PROTOTYPE
https://github.com/ruby/json/commit/dfffed72b3
2026-08-11 08:12:50 +00:00
Jean Boussier ff30aa4768 [ruby/json] Remove deprecated JSON.dump aliases
https://github.com/ruby/json/commit/545a2ed894
2026-08-11 08:12:50 +00:00
Jean Boussier f61922fda3 [ruby/json] Remove JSON::State#[] and JSON::State#[]=
https://github.com/ruby/json/commit/c1d784113c
2026-08-11 08:12:49 +00:00
Jean Boussier e8fbcef28e [ruby/json] Remove default_options singleton accessors
https://github.com/ruby/json/commit/e8f34a8f2d
2026-08-11 08:12:49 +00:00
Jean Boussier 8bf14d3a70 [ruby/json] Make allow_comments: false the default
https://github.com/ruby/json/commit/bc24969dab
2026-08-11 08:12:49 +00:00
Jean Boussier 9f836d7d13 [ruby/json] Make allow_duplicate_key: false the default
https://github.com/ruby/json/commit/e7636af6e6
2026-08-11 08:12:49 +00:00
Jean Boussier d2afbde247 [ruby/json] Remove j and jj
https://github.com/ruby/json/commit/3df735361e
2026-08-11 08:12:49 +00:00
Jean Boussier 5cee589112 [ruby/json] Release 2.21.2
https://github.com/ruby/json/commit/5a32e4367c
2026-07-31 06:25:49 +00:00
Jean Boussier bb59337860 [ruby/json] Improve max_nesting documentation
https://github.com/ruby/json/commit/5499aa54a4
2026-07-29 07:48:43 +00:00
Jean Boussier 9fd5efe9ca [ruby/json] Release 2.21.1
https://github.com/ruby/json/commit/fd61def38b
2026-07-13 07:45:00 +00:00
Jean Boussier b796b99a1e [ruby/json] Release 2.21.0
https://github.com/ruby/json/commit/9be0e8ed39
2026-07-12 06:57:34 +00:00
Shizuo FujitaandClaude Fable 5 cf42ce9d17 [ruby/json] Add JSON::ResumableParser#partial_value? and #empty?
There was no single API answering "does the stream end in the middle of
a document?" once all parseable fed bytes have been consumed. Callers
had to combine two complementary APIs:

  !parser.rest.empty? || !parser.partial_value.nil?

`rest` only reflects unconsumed tokenizer bytes, so it is empty when the
stream is truncated exactly on a token boundary (right after a ':' or
','), while `partial_value` is nil when truncation happens mid-token
before any container is registered. Neither alone covers all shapes,
and `partial_value` materializes the partially built Ruby objects just
to test for nil.

`partial_value?` answers the same question as `!partial_value.nil?` by
looking at the parser's internal value stack directly, without building
the partial Ruby object graph.

`empty?` is strict: true only when the buffer is fully consumed, no
document is under construction and no parsed value awaits retrieval
with `value`. It is defined in Ruby as the composition of the three
underlying predicates so its definition doubles as documentation:

  def empty?
    eos? && !partial_value? && !value?
  end

https://github.com/ruby/json/commit/0864e83701

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 09:24:56 +00:00
Scott MyronandJean Boussier 7c69f93d53 [ruby/json] Add a sort_keys option to the generator.
Fix: https://github.com/ruby/json/issues/976

https://github.com/ruby/json/commit/ea008e82fe

Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2026-07-02 09:24:35 +00:00
Jean Boussier 1da3f06e26 [ruby/json] Release 2.20.0
https://github.com/ruby/json/commit/13162921b8
2026-06-23 10:45:41 +00:00
Jean Boussier ea47612f7d [ruby/json] Merge 2.19.9 changes
https://github.com/ruby/json/commit/53f9d990bb
2026-06-11 18:48:32 +00:00