173 Commits
Author SHA1 Message Date
Jean BoussierandTakashi Kokubun 342caec27b Upgrade json gem to 1.8.2
Merge of the following upstream commits:

commit 6d3266dc0edbbdb1dae513f4f3be16198c432af3
Author: Jean Boussier <[email protected]>
Date:   Mon Nov 2 15:51:58 2026 +0100

    Release 2.18.2

commit dcfbbcd36f240c18c3b89e5399105715f70162e3
Author: Jean Boussier <[email protected]>
Date:   Wed Mar 25 11:45:17 2026 +0100

    Fix handling of unescaped control characters preceeded by a backslash

    GHSA-cjpr-jw2g-fw99

commit 6ec6e7baff137e67831a23090061e84bf028dbfc
Author: Jean Boussier <[email protected]>
Date:   Tue Feb 3 08:35:11 2026 +0100

    Release 2.18.1

commit fff25c9f4b9c590a59ed4a2ec3c545121db844d3
Author: Jean Boussier <[email protected]>
Date:   Mon Feb 2 19:44:02 2026 +0100

    fbuffer_append_str: assume string

commit 79b6e168ba02f6ac7a0dac378968b1c918af91db
Author: Jean Boussier <[email protected]>
Date:   Mon Feb 2 22:06:44 2026 +0100

    Ensure `Generator::State` is kept on the stack

    Fix: https://github.com/ruby/json/issues/929

    When calling `cState_partial_generate` from `mHash_to_json` or other
    `to_json` funcs, `VState` becomes unreachable very quickly, hence the
    compiler may optimize it out of the stack, and make it invisible to
    the GC stack scanning. This is particularly liekly given how aggressively
    we inline.

    Repro:

    ```ruby
    require 'json'

    test_data = {
      "flag" => true,
      "data" => 10000.times.map { [1.0] },
      :flag => false,
    }

    10.times do
      test_data.to_json
    end
    ```

    But in practice the cause was just that the issued warning calls
    Hash#inspect on a big hash, which triggers GC.

    So it can be triggered even more reliably with:

    ```ruby
    require 'json'

    module JSON
      module Common
        def self.on_mixed_keys_hash(...)
          GC.start
        end
      end
    end

    test_data = {
      "flag" => true,
      "data" => 10000.times.map { [1.0] },
      :flag => false,
    }

    test_data.to_json
    ```

commit 062fcdd22818d226f0e4b49647eb2aabbfaf002b
Author: BurdetteLamar <[email protected]>
Date:   Thu Jan 22 22:08:15 2026 +0000

    Improve class JSON intro

commit 1b276c8623da0ff9bec62396d9a7172365bc1784
Author: Jean Boussier <[email protected]>
Date:   Fri Jan 16 18:43:08 2026 +0100

    Extract json_fast_memcpy16 for readability

commit 643ee11fed6898b7e6f75f266daa6e4b2a07bb07
Author: Scott Myron <[email protected]>
Date:   Thu Jan 15 19:12:41 2026 -0600

    Use __builtin_memcpy, if available, to copy overlapping byte ranges in copy_remaining_bytes to avoid a branch to MEMCPY. Additionally use a space as padding byte instead of an 'X' so it can be represented diretly on AArch64 with a single instruction.

commit 15eb40dbdfb299813bbbb72f70e12d1614b26200
Author: Nobuyoshi Nakada <[email protected]>
Date:   Wed Jan 14 21:28:37 2026 +0900

    Remove trailing spaces [ci skip]

commit 73818b80c8fe4394153002a60ecd285e8688b4cd
Author: Scott Myron <[email protected]>
Date:   Tue Jan 13 22:17:16 2026 -0600

    initialize search.chunk_end to silence a warning about it being potentially uninitialized

commit 86a5cce405102eca15d639e2dae2f539fb3e7c26
Author: Scott Myron <[email protected]>
Date:   Mon Jan 12 18:57:09 2026 -0600

    use a conditional to select SIMD implementation rather than pointer

commit a51317c94900ec5ea44ef0fd9327cca4d601bb5c
Author: Scott Myron <[email protected]>
Date:   Fri Jan 2 20:47:59 2026 -0600

    Directly write to the output buffer when converting UTF32 to UTF8.

commit 3e23e57568d29aa96f73d5f0c27b8c3676af4ee5
Merge: 976ba366 8ad744c5
Author: Nobuyoshi Nakada <[email protected]>
Date:   Wed Dec 31 21:43:48 2025 +0900

    Merge pull request #921 from nobu/nonportable-code

    Fix non-portable code

commit 8ad744c53269330cc827bf4ae213991ae11712ce
Author: Nobuyoshi Nakada <[email protected]>
Date:   Wed Dec 31 21:40:16 2025 +0900

    Fix non-portable code

    A plain `char` may be `signed` or `unsigned` depending on the
    implementation.  Also, bitwise ORing of `signed` values ​​is not
    guaranteed to be `signed`.  To ensure portability, should logical-OR
    each comparison, but casting to `signed char` is usually sufficient.

commit 976ba36629b2d20fa4de3da12ed405ab178deeba
Author: Scott Myron <[email protected]>
Date:   Tue Dec 30 21:32:03 2025 -0600

    Simplify unescape_unicode

    Co-Authored-By: Jean Boussier <[email protected]>

commit d21d9362fa36bd1b34c53e28b04ba6e91115a3be
Author: Scott Myron <[email protected]>
Date:   Tue Dec 30 20:48:18 2025 -0600

    Keep track of the the number of additional backslashes to avoid an extra memchr searching the remaining characters when no more backslashes exist.

commit a5c160f37285cab4406017990a6a02e82e283055
Author: Jean Boussier <[email protected]>
Date:   Mon Dec 22 09:16:09 2025 +0100

    Add missing documentation for `allow_control_characters` parsing option

commit 4808fee9affb801bc9bc63ea2d69d1cb28deda2a
Author: 久我山菜々 <[email protected]>
Date:   Fri Dec 19 01:30:37 2025 +0900

    Update `fpconv_dtoa` definition to use `dest[32]`

commit 5793694ee6632245f345e3b923af5ebfd7db68a9
Author: Étienne Barrié <[email protected]>
Date:   Thu Dec 11 16:12:35 2025 +0100

    Revert "Skip test failing with JRuby in CI"

    This reverts commit b7e1734d9ca090e95b1923b05536f5fb6f437060.
2026-11-02 10:05:05 -08:00
Jean Boussierandgit 6ad4e6a298 [ruby/json] Add allow_control_characters parsing option
While it's not allowed by the spec, some parsers like Oj do
accept it, and it can be blocking a transition.

Having this feature can help people migrate.

https://github.com/ruby/json/commit/3459499cb3
2025-12-11 10:53:15 +00:00
Jean Boussierandgit 023c6d808a [ruby/json] Add a specific error for unescaped newlines
It's the most likely control character so it's worth
giving a better error message for it.

https://github.com/ruby/json/commit/1da3fd9233
2025-12-10 10:14:39 +00:00
Jean Boussierandgit d58a45d32f [ruby/json] Fix a regression in parsing of unicode surogate pairs
Fix: https://github.com/ruby/json/issues/912

In the case of surogate pairs we consume two backslashes, so
`json_next_backslash` need to ensure it's not sending us back in the
stream.

https://github.com/ruby/json/commit/0fce370c41
2025-12-04 08:10:41 +00:00
Nobuyoshi Nakadaandgit 28d9493b98 [ruby/json] Fix macro arguments
`ALWAYS_INLINE()` and `NOINLINE()` are defined with one argument.

https://github.com/ruby/json/commit/8fb727901e
2025-12-03 02:19:06 +00:00
Jean Boussierandgit c7a84ae0bb [ruby/json] parser.c: Record escape positions while parsing
We can then pass them to the decoder to save having to parse
the string again.

```
== Parsing activitypub.json (58160 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     1.275k i/100ms
Calculating -------------------------------------
               after     12.774k (± 0.8%) i/s   (78.29 μs/i) -     65.025k in   5.090834s

Comparison:
              before:    12314.3 i/s
               after:    12773.8 i/s - 1.04x  faster

== Parsing twitter.json (567916 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   143.000 i/100ms
Calculating -------------------------------------
               after      1.441k (± 0.2%) i/s  (693.86 μs/i) -      7.293k in   5.060345s

Comparison:
              before:     1430.1 i/s
               after:     1441.2 i/s - 1.01x  faster

== Parsing citm_catalog.json (1727030 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    69.000 i/100ms
Calculating -------------------------------------
               after    695.919 (± 0.4%) i/s    (1.44 ms/i) -      3.519k in   5.056691s

Comparison:
              before:      687.8 i/s
               after:      695.9 i/s - 1.01x  faster
```

https://github.com/ruby/json/commit/4f4551f993
2025-11-22 13:52:26 +00:00
Jean Boussierandgit 735762747d [ruby/json] Fix the parser to not accept invalid escapes
Only `"\/bfnrtu` are valid after a backslash.

https://github.com/ruby/json/commit/f7f8f552ed
2025-11-22 13:12:16 +00:00
Jean Boussierandgit ec296f63e3 [ruby/json] Use booleans in string_scan
https://github.com/ruby/json/commit/256cad5def
2025-11-22 09:32:48 +00:00
Étienne Barriéandgit ffa105c27f [ruby/json] Move RUBY_TYPED_FROZEN_SHAREABLE macro to json.h
https://github.com/ruby/json/commit/2a4ebe8250
2025-11-21 16:12:35 +00:00
Étienne Barriéandgit bdca2a9975 [ruby/json] Ractor-shareable JSON::Coder
https://github.com/ruby/json/commit/58d60d6b76
2025-11-21 16:12:35 +00:00
Étienne Barriéandgit 48027256cf [ruby/json] Remove unused symbols
https://github.com/ruby/json/commit/9364d0c761
2025-11-20 17:23:37 +00:00
Jean Boussierandgit d5d12efde7 [ruby/json] parser.c: Remove unued JSON_ParserStruct.parsing_name
https://github.com/ruby/json/commit/ab5efca015
2025-11-18 22:45:59 +00:00
NARUSE, Yui 4fa6e9938c strnlen is not used now 2025-11-17 21:39:04 +09:00
Jean Boussierandgit f1776e8f17 [ruby/json] Tentative fix for RHEL8 compiler
```
parser.c:87:77: error: missing binary operator before token "("
 #if JSON_CPU_LITTLE_ENDIAN_64BITS && defined(__has_builtin) && __has_builtin(__builtin_bswap64)
```

https://github.com/ruby/json/commit/fce1c7e84a
2025-11-04 11:07:31 +00:00
7c92401363 [ruby/json] Micro-optimize rstring_cache_fetch
Closes: https://github.com/ruby/json/pull/888

- Mark it as `inline`.
- Use `RSTRING_GETMEM`, instead of `RSTRING_LEN` and `RSTRING_PTR`.
- Use an inlinable version of `memcmp`.

```
== Parsing activitypub.json (58160 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Comparison:
              before:    11766.6 i/s
               after:    12272.1 i/s - 1.04x  faster

== Parsing twitter.json (567916 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Comparison:
              before:     1333.2 i/s
               after:     1422.0 i/s - 1.07x  faster

== Parsing citm_catalog.json (1727030 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Comparison:
              before:      656.3 i/s
               after:      673.1 i/s - 1.03x  faster

== Parsing float parsing (2251051 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Comparison:
              before:      276.8 i/s
               after:      276.4 i/s - same-ish: difference falls within error
```

https://github.com/ruby/json/commit/a67d1a1af4

Co-Authored-By: Scott Myron <[email protected]>
2025-11-04 08:49:57 +00:00
Jean Boussierandgit 157ae44b1e [ruby/json] Extract JSON_CPU_LITTLE_ENDIAN_64BITS definition
Only apply these definitions on 64 bits archs, as it's unclear
if they have performance benefits or compatibility issues on
32bit archs.

https://github.com/ruby/json/commit/ddad00b746
2025-11-04 08:49:57 +00:00
c49e4db680 [ruby/json] parser.c: Always inline json_eat_whitespace
```
== Parsing activitypub.json (58160 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     1.174k i/100ms
Calculating -------------------------------------
               after     11.756k (± 0.9%) i/s   (85.06 μs/i) -     59.874k in   5.093438s

Comparison:
              before:    11078.6 i/s
               after:    11756.1 i/s - 1.06x  faster

== Parsing twitter.json (567916 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   130.000 i/100ms
Calculating -------------------------------------
               after      1.340k (± 0.3%) i/s  (746.06 μs/i) -      6.760k in   5.043432s

Comparison:
              before:     1191.1 i/s
               after:     1340.4 i/s - 1.13x  faster

== Parsing citm_catalog.json (1727030 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    68.000 i/100ms
Calculating -------------------------------------
               after    689.451 (± 1.6%) i/s    (1.45 ms/i) -      3.468k in   5.031470s

Comparison:
              before:      630.3 i/s
               after:      689.5 i/s - 1.09x  faster

== Parsing float parsing (2251051 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    27.000 i/100ms
Calculating -------------------------------------
               after    248.265 (± 0.8%) i/s    (4.03 ms/i) -      1.242k in   5.003185s

Comparison:
              before:      232.7 i/s
               after:      248.3 i/s - 1.07x  faster
```

https://github.com/ruby/json/commit/043880f6ab

Co-Authored-By: Scott Myron <[email protected]>
2025-11-03 13:12:47 +00:00
Jean Boussierandgit 52a17bbe6d [ruby/json] parser.c: use rb_str_to_interned_str over rb_funcall
https://github.com/ruby/json/commit/21284ea649
2025-11-03 10:46:26 +00:00
Jean Boussierandgit 0832e954c9 [ruby/json] parser.c: Extract json_string_cacheable_p
We can share that logic between the two functions.

https://github.com/ruby/json/commit/ac580458e0
2025-11-03 10:33:44 +00:00
ea0a411f25 [ruby/json] parser.c: simplify sorted insert loop in rstring_cache_fetch
https://github.com/ruby/json/commit/31453b8e95

Co-Authored-By: Scott Myron <[email protected]>
2025-11-03 10:13:37 +00:00
edebd83ea9 [ruby/json] parser.c: Skip checking for escape sequences in rstring_cache_fetch
The caller already know if the string contains escape sequences
so this check is redundant.

Also stop calling `rstring_cache_fetch` from `json_string_unescape`
as we know it won't match anyways.

```
== Parsing twitter.json (567916 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   122.000 i/100ms
Calculating -------------------------------------
               after      1.226k (± 0.3%) i/s  (815.85 μs/i) -      6.222k in   5.076282s

Comparison:
              before:     1206.2 i/s
               after:     1225.7 i/s - 1.02x  faster
```

https://github.com/ruby/json/commit/b8cdf3282d

Co-Authored-By: Scott Myron <[email protected]>
2025-11-03 09:58:01 +00:00
Jean Boussierandgit 35a5e55133 [ruby/json] Centralize macro definitions
https://github.com/ruby/json/commit/1576ea7d47
2025-11-03 09:22:40 +00:00
Jean Boussierandgit 5384136eb5 [ruby/json] Enable JSON_DEBUG for parser/extconf.rb
https://github.com/ruby/json/commit/82b030f294
2025-11-01 14:35:23 +00:00
Jean Boussierandgit a97f4c627f [ruby/json] parser.c: Appease GCC warning
```
 ../../../../../../ext/json/ext/parser/parser.c:1142:40: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 1142 |     if (RB_UNLIKELY(first_digit == '0' && mantissa_digits > 1 || negative && mantissa_digits == 0)) {
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
```

https://github.com/ruby/json/commit/ded62a5122
2025-11-01 12:06:03 +00:00
ed7229eac8 [ruby/json] parser.c: Use SWAR to skip consecutive spaces
Closes: https://github.com/ruby/json/pull/881

If we encounter a newline, it is likely that the document is pretty printed,
hence that the newline is followed by multiple spaces.

In such case we can use SWAR to count up to eight consecutive spaces at once.

```
== Parsing activitypub.json (58160 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     1.118k i/100ms
Calculating -------------------------------------
               after     11.223k (± 0.7%) i/s   (89.10 μs/i) -     57.018k in   5.080522s

Comparison:
              before:    10834.4 i/s
               after:    11223.4 i/s - 1.04x  faster

== Parsing twitter.json (567916 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   118.000 i/100ms
Calculating -------------------------------------
               after      1.188k (± 1.0%) i/s  (841.62 μs/i) -      6.018k in   5.065355s

Comparison:
              before:     1094.8 i/s
               after:     1188.2 i/s - 1.09x  faster

== Parsing citm_catalog.json (1727030 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    58.000 i/100ms
Calculating -------------------------------------
               after    570.506 (± 3.7%) i/s    (1.75 ms/i) -      2.900k in   5.091529s

Comparison:
              before:      419.6 i/s
               after:      570.5 i/s - 1.36x  faster

== Parsing float parsing (2251051 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    22.000 i/100ms
Calculating -------------------------------------
               after    212.010 (± 1.9%) i/s    (4.72 ms/i) -      1.078k in   5.086885s

Comparison:
              before:      189.4 i/s
               after:      212.0 i/s - 1.12x  faster
```

https://github.com/ruby/json/commit/b3fd7b26be

Co-Authored-By: Scott Myron <[email protected]>
2025-11-01 12:00:01 +00:00
babf50e33b [ruby/json] Use SWAR for parsing integers on little endian machines
Closes: https://github.com/ruby/json/pull/878

```
== Parsing float parsing (2251051 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    23.000 i/100ms
Calculating -------------------------------------
               after    214.382 (± 0.5%) i/s    (4.66 ms/i) -      1.081k in   5.042555s

Comparison:
              before:      189.5 i/s
               after:      214.4 i/s - 1.13x  faster
```

https://github.com/ruby/json/commit/6348ff0891

Co-Authored-By: Scott Myron <[email protected]>
2025-11-01 10:22:55 +00:00
Jean Boussierandgit bca8fce78f [ruby/json] parser.c: Introduce rest() helper
https://github.com/ruby/json/commit/11f4e7b7be
2025-11-01 09:54:46 +00:00
Jean Boussierandgit b3d5c96613 [ruby/json] parser.c: Introduce peek() and eos() helpers
Encapsulate pointer arithmetic to reduce possibility of mistakes.

https://github.com/ruby/json/commit/8b39407225
2025-11-01 09:40:16 +00:00
Jean Boussierandgit a6bdf52bc9 [ruby/json] parser.c: Extract json_parse_digits
https://github.com/ruby/json/commit/1bf405ecc6
2025-11-01 08:52:35 +00:00
Jean Boussierandgit 6e2e7a3355 [ruby/json] parser.c: Extract json_parse_number
https://github.com/ruby/json/commit/2681b23b87
2025-11-01 08:52:35 +00:00
3ca4321680 [ruby/json] Add ryu float parser.
https://github.com/ruby/json/commit/9c4db31908

Co-Authored-By: Jean Boussier <[email protected]>
2025-10-30 10:56:36 +00:00
Jean Boussierandgit 2a9d15b969 [ruby/json] parser.c: Fix indentation in json_decode_integer
https://github.com/ruby/json/commit/f228b30635
2025-10-27 09:22:40 +00:00
Jean Boussierandgit 14cbe0de8b [ruby/json] Use locale indepenent version of islapha
https://github.com/ruby/json/commit/1ba1e9bef9
2025-10-27 09:21:38 +00:00
Jean BoussierandHiroshi SHIBATA 3faf2a31fb [ruby/json] parser: Reject invalid surogate pairs more consistently.
https://github.com/ruby/json/commit/5855f4f603
2025-09-19 19:30:10 +09:00
Jean BoussierandHiroshi SHIBATA d9e9a667a8 JSON.generate: warn or raise on duplicated key
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-27 10:01:52 +09:00
Jean BoussierandHiroshi SHIBATA f6823936fa [ruby/json] parser.c: Remove useless dereference
https://github.com/ruby/json/commit/2d63648c0a
2025-08-27 10:01:52 +09:00
Douglas EichelbergerandHiroshi SHIBATA e3ce56c9dc Fix typos 2025-08-18 12:31:51 +09:00
Jean BoussierandHiroshi SHIBATA d0020d58f4 [ruby/json] Fix duplicated key warning location
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 09:39:12 +09:00
Jean BoussierandHiroshi SHIBATA b4ef5da70b [ruby/json] Improve duplicate key warning and errors to include the key name
Followup: https://github.com/ruby/json/pull/818

https://github.com/ruby/json/commit/e3de4cc59c
2025-07-28 09:39:11 +09:00
Jean BoussierandHiroshi SHIBATA d0fdbef4ea [ruby/json] Improve consistency of code style
https://github.com/ruby/json/commit/a497c71960
2025-07-07 11:53:23 +09:00
Nobuyoshi Nakada 400793426a [ruby/json] Remove trailing spaces [ci skip]
https://github.com/ruby/json/commit/68ee9cf188
2025-07-01 00:43:41 +09:00
Scott MyronandHiroshi SHIBATA 50b6cd409a Optimize 'json_parse_string' using SIMD. 2025-06-30 12:56:50 +09:00
Jean BoussierandHiroshi SHIBATA 93fc29c65c [ruby/json] Deprecate duplicate keys in object
There are few legitimate use cases for duplicate keys, and can
in some case be exploited.

Rather to always silently accept them, we should emit a warning,
and in the future require to explictly allow them.

https://github.com/ruby/json/commit/06f00a42e8
2025-06-24 12:10:50 +09:00
Jean BoussierandHiroshi SHIBATA cd7495a1d0 [ruby/json] Further improve parsing errors
Report EOF when applicable instead of an empty fragment.

Also stop fragment extraction on first whitespace.

https://github.com/ruby/json/commit/cc1daba860
2025-05-13 14:12:22 +09:00
Jean BoussierandHiroshi SHIBATA 8cc1aa82f1 [ruby/json] Add missing single quotes in error messages
https://github.com/ruby/json/commit/f3dde3cb2f
2025-05-13 14:12:22 +09:00
Jean BoussierandHiroshi SHIBATA 50ef208369 [ruby/json] parser.c: include line and column in error messages
https://github.com/ruby/json/commit/30e35b9ba5
2025-05-13 14:12:22 +09:00
Jean BoussierandHiroshi SHIBATA 8f008598c3 [ruby/json] parser.c: refactor raise_parse_error to have document start
https://github.com/ruby/json/commit/832b5b1a4c
2025-05-13 14:12:22 +09:00
Jean BoussierandHiroshi SHIBATA ec171b4075 [ruby/json] Move create_addtions logic in Ruby.
By leveraging the `on_load` callback we can move all this logic
out of the parser. Which mean we no longer have to duplicate
that logic in both parser and that we'll later be able to extract
it entirely from the gem.

https://github.com/ruby/json/commit/f411ddf1ce
2025-03-28 12:44:53 +09:00
Jean BoussierandHiroshi SHIBATA e8c46f4ca5 [ruby/json] JSON.load invoke the proc callback directly from the parser.
And substitute the return value like `Marshal.load` doesm
which I can only assume was the intent.

This also open the door to re-implement all the `create_addition`
logic in `json/common.rb`.

https://github.com/ruby/json/commit/73d2137fd3
2025-03-28 12:44:53 +09:00
Jean BoussierandHiroshi SHIBATA 756b75f242 [ruby/json] Remove Class#json_creatable? monkey patch.
https://github.com/ruby/json/commit/1ca7efed1f
2025-03-28 12:44:53 +09:00