Releases: ruby/json
Releases Β· ruby/json
v2.17.0
What's Changed
- Improve
JSON.loadandJSON.unsafe_loadto allow passing options as second argument. - Fix the parser to no longer ignore invalid escapes in strings.
Only\",\\,\b,\f,\n,\r,\tand\uare valid JSON escapes. - Fixed
JSON::Coderto use the depth it was initialized with. - On TruffleRuby, fix the generator to not call
to_jsonon the return value ofas_jsonforFloat::NAN. - Fixed handling of
state.depth: whento_jsonchangesstate.depthbut does not restore it, it is reset
automatically to its initial value.
In particular, when aNestingErroris raised,depthis no longer equal tomax_nestingafter the call to
generate, and is reset to its initial value. Similarly whento_jsonraises an exception.
Full Changelog: v2.16.0...v2.17.0
v2.16.0
What's Changed
- Deprecate
JSON::State#[]andJSON::State#[]=. Consider usingJSON::Coderinstead. JSON::Codernow also yields to the block when encountering strings with invalid encoding.- Fix GeneratorError messages to be UTF-8 encoded.
- Fix memory leak when
Exceptionis raised, orthrowis 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
What's Changed
- Fix
JSON::Coderto have one dedicated depth counter per invocation.
After encountering a circular reference inJSON::Coder#dump, any further#dumpcall would raiseJSON::NestingError.
Full Changelog: v2.15.1...v2.15.2
v2.15.1
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
What's Changed
JSON::Codercallback 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
What's Changed
- Fix
IndexOutOfBoundsExceptionin the JRuby extension when encoding shared strings.
Full Changelog: v2.14.0...v2.14.1
v2.14.0
What's Changed
- Add new
allow_duplicate_keygenerator options. By default a warning is now emitted when a duplicated key is encountered.
Injson 3.0an error will be raised.>> Warning[:deprecated] = true >> puts JSON.generate({ foo: 1, "foo" => 2 }) (irb):2: warning: detected duplicate key "foo" in {foo: 1, "foo" => 2}. This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true` {"foo":1,"foo":2} >> JSON.generate({ foo: 1, "foo" => 2 }, allow_duplicate_key: false) detected duplicate key "foo" in {foo: 1, "foo" => 2} (JSON::GeneratorError)
- Fix
JSON.generatestrict: truemode to also restrict hash keys. - Fix
JSON::Coderto also invoke block for hash keys that aren't strings nor symbols. - Fix
JSON.unsafe_loadusage with proc - Fix the parser to more consistently reject invalid UTF-16 surogate pairs.
- Stop defining
String.json_create,String#to_json_raw,String#to_json_raw_objectwhenjson/addisn't loaded.
Full Changelog: v2.13.2...v2.14.0
v2.13.2
What's Changed
- Improve duplicate key warning and errors to include the key name and point to the right caller.
Full Changelog: v2.13.1...v2.13.2
v2.13.1
What's Changed
- Fix support for older compilers without
__builtin_cpu_supports.
Full Changelog: v2.13.0...v2.13.1
v2.13.0
What's Changed
- Add new
allow_duplicate_keyparsing options. By default a warning is now emitted when a duplicated key is encountered.
Injson 3.0an error will be raised. - Optimize parsing further using SIMD to scan strings.
Full Changelog: v2.12.2...v2.13.0