summaryrefslogtreecommitdiff
path: root/ext/json
AgeCommit message (Collapse)Author
2025-10-30[ruby/json] Add ryu float parser.Josef Šimánek
https://github.com/ruby/json/commit/9c4db31908 Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
2025-10-30[ruby/json] Fix GeneratorError messages to be UTF-8 encodedJean Boussier
https://github.com/ruby/json/commit/965ba6c5d4
2025-10-27[ruby/json] parser.c: Fix indentation in json_decode_integerJean Boussier
https://github.com/ruby/json/commit/f228b30635
2025-10-27[ruby/json] Use locale indepenent version of `islapha`Jean Boussier
https://github.com/ruby/json/commit/1ba1e9bef9
2025-10-25[ruby/json] Release 2.15.2Jean Boussier
https://github.com/ruby/json/commit/5e61cd7dce
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-10-07[ruby/json] Release 2.15.1Jean Boussier
https://github.com/ruby/json/commit/9e6067bb55
2025-10-02[ruby/json] Release 2.15.0Jean Boussier
https://github.com/ruby/json/commit/4abfad090d
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-09-19[ruby/json] Avoid scientific notation before exponent 15Jean Boussier
Fix: https://github.com/ruby/json/issues/861 It's not incorrect to use scientific notation, but it tend to throw people off a bit, so it's best to keep it for very large numbers. https://github.com/ruby/json/commit/1566cd01a6
2025-09-19[ruby/json] Release 2.14.1Jean Boussier
https://github.com/ruby/json/commit/51ce76ea66
2025-09-19[ruby/json] Release 2.14.0Jean Boussier
https://github.com/ruby/json/commit/55552cafe2
2025-09-19[ruby/json] parser: Reject invalid surogate pairs more consistently.Jean Boussier
https://github.com/ruby/json/commit/5855f4f603
2025-09-11[ruby/json] Stop checking for OpenStruct#[] and #[]=Étienne Barrié
https://github.com/ruby/json/commit/3232e8df41 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-09-11[ruby/json] Fix deprecation warning backtraceÉtienne Barrié
The gem root was including the test/ directory, so lines from tests were skipped, and the deprecation warnings were shown as coming from the test framework. https://github.com/ruby/json/commit/2ec31a7363 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-09-11[ruby/json] Don't call json_create if json_creatable? returns falseÉtienne Barrié
Fix https://github.com/ruby/json/commit/f411ddf1ceaf https://github.com/ruby/json/commit/1397bf8cc9 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-09-03[ruby/json] Update method docs for JSON.load and JSON.unsafe_load to show ↵Robin Miller
the correct use of proc argument. https://github.com/ruby/json/commit/92654cd99b
2025-09-03[ruby/json] Added testing for JSON.unsafe_load. Fixes NoMethodErrorRobin Miller
when passing proc to JSON.unsafe_load, matching the changes made in https://github.com/ruby/json/commit/73d2137fd3ad. https://github.com/ruby/json/commit/77292cbc9b
2025-09-03[ruby/json] Fix a -Wreturn-type warningJean Boussier
Fix: https://github.com/ruby/json/pull/843 https://github.com/ruby/json/commit/d3f7f0452b Co-Authored-By: Takashi Kokubun <takashikkbn@gmail.com>
2025-08-27JSON.generate: warn or raise on duplicated keyJean Boussier
Because both strings and symbols keys are serialized the same, it always has been possible to generate documents with duplicated keys: ```ruby >> puts JSON.generate({ foo: 1, "foo" => 2 }) {"foo":1,"foo":2} ``` This is pretty much always a mistake and can cause various issues because it's not guaranteed how various JSON parsers will handle this. Until now I didn't think it was possible to catch such case without tanking performance, hence why I only made the parser more strict. But I finally found a way to check for duplicated keys cheaply enough.
2025-08-27Fix `JSON::Coder` to cast non-string keys.Jean Boussier
2025-08-27Fix `JSON.generate` `strict: true` mode to also restrict hash keysJean Boussier
2025-08-27[ruby/json] Improve generation options documentationJean Boussier
https://github.com/ruby/json/commit/3187c88c06
2025-08-27[ruby/json] Remove reference to fast_generateJean Boussier
https://github.com/ruby/json/commit/19bcfdd8d8
2025-08-27[ruby/json] Optimize `fbuffer_append_str_repeat`Jean Boussier
Helps with pretty printting performance: ``` == Encoding activitypub.json (52595 bytes) ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 1.746k i/100ms Calculating ------------------------------------- after 17.481k (± 1.0%) i/s (57.20 μs/i) - 89.046k in 5.094341s Comparison: before: 16038.4 i/s after: 17481.1 i/s - 1.09x faster == Encoding citm_catalog.json (500298 bytes) ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 60.000 i/100ms Calculating ------------------------------------- after 608.157 (± 2.3%) i/s (1.64 ms/i) - 3.060k in 5.034238s Comparison: before: 525.3 i/s after: 608.2 i/s - 1.16x faster == Encoding twitter.json (466906 bytes) ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 160.000 i/100ms Calculating ------------------------------------- after 1.606k (± 0.5%) i/s (622.70 μs/i) - 8.160k in 5.081406s Comparison: before: 1410.3 i/s after: 1605.9 i/s - 1.14x faster ``` https://github.com/ruby/json/commit/f0dda861c5
2025-08-27[ruby/json] parser.c: Remove useless dereferenceJean Boussier
https://github.com/ruby/json/commit/2d63648c0a
2025-08-27[ruby/json] Extract `fbuffer_append_str_repeat` functionJean Boussier
https://github.com/ruby/json/commit/12656777dc
2025-08-18Fix typosDouglas Eichelberger
2025-08-18[ruby/json] Append newline at EOF [ci skip]Nobuyoshi Nakada
https://github.com/ruby/json/commit/72e231f929
2025-08-18[ruby/json] Remove trailing spaces [ci skip]Nobuyoshi Nakada
https://github.com/ruby/json/commit/2d2e0d403d
2025-08-04Only define `String.json_create` & al when `json/add` is requiredJean Boussier
All the `json/add` related methods for string were always defined unconditionally from the generators. It's preferable to only define them if `json/add` is actually used.
2025-07-29[ruby/json] Release 2.13.2Jean Boussier
https://github.com/ruby/json/commit/9e3efbfa22
2025-07-28[ruby/json] Improve deprecation warning location detectionJean Boussier
https://github.com/ruby/json/commit/132049bde2
2025-07-28[ruby/json] Fix duplicated key warning locationJean Boussier
Followup: https://github.com/ruby/json/pull/818 Now the warning should point at the `JSON.parse` caller, and not inside the json gem itself. https://github.com/ruby/json/commit/cd51557387
2025-07-28[ruby/json] Improve duplicate key warning and errors to include the key nameJean Boussier
Followup: https://github.com/ruby/json/pull/818 https://github.com/ruby/json/commit/e3de4cc59c
2025-07-27[ruby/json] Keep indentation consistent across functions [ci skip]Nobuyoshi Nakada
https://github.com/ruby/json/commit/1988a3ae4c
2025-07-27[ruby/json] Functions defined in headers should be `static inline`Nobuyoshi Nakada
If `load_uint8x16_4` has an external linkage, it is defined in both `generator` and `parser` extension libraries. This duplicate symbol causes a linker error when `--with-static-linked-ext` is given, on some platforms. https://github.com/ruby/json/commit/020693b17a
2025-07-25[ruby/json] Release 2.13.1Jean Boussier
https://github.com/ruby/json/commit/cfe9337eda
2025-07-25[ruby/json] Don't assume `__builtin_cpu_supports` existsJean Boussier
Fix: https://github.com/ruby/json/issues/827 On very old compilers it might not exist, at that point might as well skip SIMD entirely. https://github.com/ruby/json/commit/da878435dc
2025-07-25[ruby/json] Fix missing write barrier on Generator StateJohn Hawthorn
Found by wbcheck WBCHECK ERROR: Missed write barrier detected! Parent object: 0x7b7b8487c450 (wb_protected: true) rb_obj_info_dump: 0x00007b7b8487c450 JSON/Generator/State/JSON::Ext::Generator::State JSON/Generator/State Reference counts - snapshot: 1, writebarrier: 0, current: 6, missed: 5 Missing reference to: 0x7b7b82f35a10 rb_obj_info_dump: 0x00007b7b82f35a10 T_STRING/String len: 1, capa: 15 "1" Missing reference to: 0x7b7b82f35e90 rb_obj_info_dump: 0x00007b7b82f35e90 T_STRING/String len: 1, capa: 15 "2" Missing reference to: 0x7b7b83629e50 rb_obj_info_dump: 0x00007b7b83629e50 T_STRING/String len: 1, capa: 15 "3" Missing reference to: 0x7b7b83b62190 rb_obj_info_dump: 0x00007b7b83b62190 T_STRING/String len: 1, capa: 15 "4" Missing reference to: 0x7b7b83629490 rb_obj_info_dump: 0x00007b7b83629490 T_STRING/String len: 1, capa: 15 "5" https://github.com/ruby/json/commit/c24342d801
2025-07-18[ruby/json] Release 2.13.0Jean Boussier
https://github.com/ruby/json/commit/8d08494dee
2025-07-11Update dependencies for addition of set.h to public headersJeremy Evans
2025-07-07[ruby/json] Improve consistency of code styleJean Boussier
https://github.com/ruby/json/commit/a497c71960
2025-07-01[ruby/json] Run `have_func` with the header providing the declarationsNobuyoshi Nakada
https://github.com/ruby/json/commit/95fb084027
2025-07-01[ruby/json] Stop calling `__builtin_cpu_init`Jean Boussier
It's only needed if using GCC `ifunc` mecanism, which we don't. https://github.com/ruby/json/commit/d3317b9f82
2025-07-01[ruby/json] Suppress -Wunused-functionTakashi Kokubun
https://github.com/ruby/json/commit/94ed471814
2025-07-01[ruby/json] Refactor simd/conf.rb - duplicate codeNobuyoshi Nakada
Integrate duplicate code by extracting headers, types and initialization code. https://github.com/ruby/json/commit/1a768d9179
2025-07-01[ruby/json] Refactor simd/conf.rb - unnecessary `have_type`Nobuyoshi Nakada
Remove `have_type` calls because the next `try_compile` calls check those types. https://github.com/ruby/json/commit/b08e1ca2c1
2025-07-01[ruby/json] Refactor simd/conf.rb - conditions to enableNobuyoshi Nakada
See the results of `have_type` and `try_compile` in addition to `have_header` for NEON as well as x86_64. The former results were just ignored, and `HAVE_TYPE_` macros are unused too. https://github.com/ruby/json/commit/fdbb6062c2
2025-07-01[ruby/json] Refactor simd/conf.rb - balanceNobuyoshi Nakada
Align code for arm and x86_64 in parallel. https://github.com/ruby/json/commit/2211e30a59