Skip to content

Releases

v2.18.3

Choose a tag to compare

@byroot byroot released this 17 Nov 18:36

Full Changelog: v2.18.2...v2.18.3

v2.18.2

Choose a tag to compare

@byroot byroot released this 17 Nov 18:36
  • Backport handling of unescaped control characters preceeded by a backslash from 2.19.3.
    GHSA-cjpr-jw2g-fw99.

Full Changelog: v2.18.1...v2.18.2

v3.1.0

Choose a tag to compare

@byroot byroot released this 17 Nov 18:32

What's Changed

  • Added rfc8785 generator option to canonicalize the output. Replaces the json-canonicalization with numerous correctness fixes.
  • Use the rb_len_t type introduced in Ruby 4.1 to allow for proper 64bit support on LP64 platforms (Windows).
  • JRuby: parser errors now include the position (line, column and the message suffix) as well as json_path, matching the C extension.
  • Improved the accuracy of parser error's line, column and snipets in presence of multibyte characters.
  • Fix JSON.load to work correctly when provided a Zlib::GzipReader as IO source.
  • Reject non-ASCII BINARY strings during JSON generation. This was deprecated since a long time and scheduled to be removed for 3.0.

Full Changelog: v3.0.2...v3.1.0

v3.0.2

Choose a tag to compare

@byroot byroot released this 17 Nov 18:31

What's Changed

  • 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 ....

Full Changelog: v3.0.1...v3.0.2

v3.0.1

Choose a tag to compare

@byroot byroot released this 17 Nov 18:30

What's Changed

  • Restore the limit positional argument of JSON.dump by @byroot in #1071

Full Changelog: v3.0.0...v3.0.1

v3.0.0

Choose a tag to compare

@byroot byroot released this 07 Sep 06:58

With the removal of the insecure create_additions option, JSON.load and JSON.dump are now safe to use. Them being unsafe by default caused multiple security vulnerabilites in the past.

If you did depend on create_additions, the recommended migration is to implement a custom serializer using JSON::Coder.

All the mutable default options, such as JSON.load_default_options have been removed. They were preventing Ractor compatiblity, and causing bug in libraries using JSON expecting the default behavior. JSON methods now always behave the same unless monkey patched.

All methods options are now either keyword arguments or checked like keyword arguments, meaning unknown options such as typos raise ArgumentError.

Duplicated keys are now rejected by default.

JavaScript comments in documents are no longer supported by default.

Numerous rarely used aliases have been removed.

  • 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.
  • 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.
  • JSON.load defaults are now safe to use.
  • All unknown options will now cause an ArgumentError rather than to be ignored.
  • The allow_comments parsing option now defaults to false.
  • The allow_duplicate_key option now defaults to false, for both parsing and generating JSON.
  • Removed the limit positional argument of JSON.dump.
  • Removed the escape_slash alias of script_safe.
  • Removed Kernel#j and Kernel#jj.
  • Removed JSON.load_default_options.
  • Removed JSON.unsafe_load_default_options.
  • Removed JSON.dump_default_options.
  • Removed JSON::State#[] and JSON::State#[]=.
  • Removed JSON.unparse.
  • Removed JSON.fast_generate.
  • Removed JSON.fast_unparse.
  • Removed JSON.pretty_unparse.
  • Removed JSON.restore.
  • Removed JSON::PRETTY_STATE_PROTOTYPE.
  • Removed the insecure create_additions option.
  • Removed JSON::GenericObject.

Full Changelog: v2.21.2...v3.0.0

v3.0.0.rc1

v3.0.0.rc1 Pre-release
Pre-release

Choose a tag to compare

@byroot byroot released this 11 Aug 08:14

With the removal of the insecure create_additions option, JSON.load and JSON.dump are
now safe to use. Them being unsafe by default caused multiple security vulnerabilites in the past.

If you did depend on create_additions, the recommended migration is to implement a custom serializer using
JSON::Coder
.

All the mutable default options, such as JSON.load_default_options have been removed.
They were preventing Ractor compatiblity, and causing bug in libraries using JSON expecting the default behavior.
JSON methods now always behave the same unless monkey patched.

All methods options are now either keyword arguments or checked like keyword arguments, meaning
unknown options such as typos raise ArgumentError.

Duplicated keys are now rejected by default.

JavaScript comments in documents are no longer supported by default.

Numerous rarely used aliases have been removed.

  • JSON.load defaults are now safe to use.
  • All unknown options are now cause an ArgumentError rather than to be ignored.
  • The allow_comments parsing option now default to false.
  • The allow_duplicate_key option now defaults to false, for both parsing and generating JSON.
  • Removed the limit positional argument of JSON.dump.
  • Removed the escape_slash alias of script_safe.
  • Removed Kernel#j and Kernel#jj.
  • Removed JSON.load_default_options.
  • Removed JSON.unsafe_load_default_options.
  • Removed JSON.dump_default_options.
  • Removed JSON::State#[] and JSON::State#[]=.
  • Removed JSON.unparse.
  • Removed JSON.fast_generate.
  • Removed JSON.fast_unparse.
  • Removed JSON.pretty_unparse.
  • Removed JSON.restore.
  • Removed JSON::PRETTY_STATE_PROTOTYPE.
  • Removed the insecure create_additions option.
  • Removed JSON::GenericObject.

Full Changelog: v2.21.2...v3.0.0.rc1

v2.21.2

Choose a tag to compare

@byroot byroot released this 31 Jul 06:27

What's Changed

Full Changelog: v2.21.1...v2.21.2

v2.21.0

Choose a tag to compare

@byroot byroot released this 12 Jul 06:58

What's Changed

  • JSON.generate now accept a sort_keys option, which takes either a boolean or a block.
  • Added #empty? and #partial_value? methods on JSON::ResumableParser.
  • Numerous correctness and performance fixes for JSON::ResumableParser.
  • Avoid triggering Ruby's float out of range warning when parsing out of range numbers.
  • Declare C types with Ruby 4.1 RUBY_TYPED_THREAD_SAFE_FREE.

Full Changelog: v2.20.0...v2.21.0

v2.20.0

Choose a tag to compare

@byroot byroot released this 23 Jun 14:24

What's Changed

  • Both C and Java parsers are no longer recursive, so parsing very deep documents with max_nesting: false will no longer
    result in SystemStackError stack level too deep errors.
    • The :max_nesting option still defaults to 100.
  • Optimized floating point number parsing further by replacing the ryu algorithm by a port of Eisel-Lemire Fast Float.
  • Added JSON::ResumableParser to parse streams of JSON documents. Not yet available on JRuby.
  • Deprecate default support of JavaScript comments in the parser and add allow_comments: true parsing option.
  • Integrate with Ruby 4.1 ruby_sized_xfree.

Full Changelog: v2.19.8...v2.20.0