summaryrefslogtreecommitdiff
path: root/test/json/json_coder_test.rb
AgeCommit message (Collapse)Author
2025-11-27[ruby/json] Respect Coder depth when generatingÉtienne Barrié
https://github.com/ruby/json/commit/9c36681b17
2025-11-27[ruby/json] Test current behavior regarding depth for CoderÉtienne Barrié
Coder currently ignores its depth and always resets it to 0 when generating a new JSON document. https://github.com/ruby/json/commit/cca1f38316
2025-11-02[ruby/json] Invoke `as_json` callback for strings with invalid encodingJean Boussier
Fix: https://github.com/ruby/json/issues/873 This allow users to encode binary strings if they so wish. e.g. they can use Base64 or similar, or chose to replace invalid characters with something else. https://github.com/ruby/json/commit/b1b16c416f
2025-10-25[ruby/json] Fix concurrent usage of JSON::Coder#dumpJean Boussier
Fix: https://github.com/rails/rails/commit/90616277e3d8fc46c9cf35d6a7470ff1ea0092f7#r168784389 Because the `depth` counter is inside `JSON::State` it can't be used concurrently, and in case of a circular reference the counter may be left at the max value. The depth counter should be moved outside `JSON_Generator_State` and into `struct generate_json_data`, but it's a larger refactor. In the meantime, `JSON::Coder` calls `State#generate_new` so I changed that method so that it first copy the state on the stack. https://github.com/ruby/json/commit/aefa671eca
2025-09-19`JSON::Coder` callback now recieve a second argument to mark object keysJean Boussier
e.g. ```ruby { 1 => 2 } ``` The callback will be invoked for `1` as while it has a native JSON equivalent, it's not legal as an object name.
2025-08-27Fix `JSON::Coder` to cast non-string keys.Jean Boussier
2025-02-06Fix JSON::Coder to call as_json proc for NaN and InfinityÉtienne Barrié
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-01-28Introduce JSON::CoderÉtienne Barrié
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>