Skip to content

Releases: ruby/json

v2.19.0

06 Mar 08:14

Choose a tag to compare

What's Changed

  • Fix allow_blank parsing option to no longer allow invalid types (e.g. load([], allow_blank: true) now raise a type error).
  • Add allow_invalid_escape parsing option to ignore backslashes that aren't followed by one of the valid escape characters.

Full Changelog: v2.18.1...v2.19.0

v2.18.1

03 Feb 07:48

Choose a tag to compare

What's Changed

  • Fix a potential crash in very specific circumstance if GC triggers during a call to to_json
    without first invoking a user defined #to_json method.

Full Changelog: v2.18.0...v2.18.1

v2.18.0

11 Dec 11:04

Choose a tag to compare

What's Changed

  • Add :allow_control_characters parser options, to allow JSON strings containing unescaped ASCII control characters (e.g. newlines).

Full Changelog: v2.17.1...v2.18.0

v2.17.1

11 Dec 11:04

Choose a tag to compare

What's Changed

  • Fix a regression in parsing of unicode surogate pairs (\uXX\uXX) that could cause an invalid string to be returned.

Full Changelog: v2.17.0...v2.17.1

v2.17.0

03 Dec 15:25

Choose a tag to compare

What's Changed

  • Improve JSON.load and JSON.unsafe_load to allow passing options as second argument.
  • Fix the parser to no longer ignore invalid escapes in strings.
    Only \", \\, \b, \f, \n, \r, \t and \u are valid JSON escapes.
  • Fixed JSON::Coder to use the depth it was initialized with.
  • On TruffleRuby, fix the generator to not call to_json on the return value of as_json for Float::NAN.
  • Fixed handling of state.depth: when to_json changes state.depth but does not restore it, it is reset
    automatically to its initial value.
    In particular, when a NestingError is raised, depth is no longer equal to max_nesting after the call to
    generate, and is reset to its initial value. Similarly when to_json raises an exception.

Full Changelog: v2.16.0...v2.17.0

v2.16.0

07 Nov 09:14

Choose a tag to compare

What's Changed

  • Deprecate JSON::State#[] and JSON::State#[]=. Consider using JSON::Coder instead.
  • JSON::Coder now also yields to the block when encountering strings with invalid encoding.
  • Fix GeneratorError messages to be UTF-8 encoded.
  • Fix memory leak when Exception is raised, or throw is used during JSON generation.
  • Optimized floating point number parsing by integrating the ryu algorithm (thanks to Josef Šimánek).
  • Optimized numbers parsing using SWAR (thanks to Scott Myron).
  • Optimized parsing of pretty printed documents using SWAR (thanks to Scott Myron).

Full Changelog: v2.15.2...v2.16.0

v2.15.2

25 Oct 09:00

Choose a tag to compare

What's Changed

  • Fix JSON::Coder to have one dedicated depth counter per invocation.
    After encountering a circular reference in JSON::Coder#dump, any further #dump call would raise JSON::NestingError.

Full Changelog: v2.15.1...v2.15.2

v2.15.1

07 Oct 08:32

Choose a tag to compare

What's Changed

  • Fix incorrect escaping in the JRuby extension when encoding shared strings.

Full Changelog: v2.15.0...v2.15.1

v2.15.0

22 Sep 10:05

Choose a tag to compare

What's Changed

  • JSON::Coder callback now receive a second argument to convey whether the object is a hash key.
  • Tuned the floating point number generator to not use scientific notation as aggressively.

Full Changelog: v2.14.1...v2.15.0

v2.14.1

18 Sep 14:32

Choose a tag to compare

What's Changed

  • Fix IndexOutOfBoundsException in the JRuby extension when encoding shared strings.

Full Changelog: v2.14.0...v2.14.1