Skip to content

Replace multi_json and oj gems with standard Ruby json gem#2992

Open
larouxn wants to merge 1 commit into
elastic:mainfrom
larouxn:farewell_multi_json
Open

Replace multi_json and oj gems with standard Ruby json gem#2992
larouxn wants to merge 1 commit into
elastic:mainfrom
larouxn:farewell_multi_json

Conversation

@larouxn

@larouxn larouxn commented Jun 19, 2026

Copy link
Copy Markdown

Description

Proposing we remove the multi_json and oj gems in favour of the standard Ruby json gem as it's now as fast or faster in the majority of cases compared to oj. Additionally allows us to simplify code quite a bit too. ✨

Related efforts

Implementation

More or less just a swap and cleanup. Nothing of particular note stands out.

@cla-checker-service

cla-checker-service Bot commented Jun 19, 2026

Copy link
Copy Markdown

💚 CLA has been signed

@larouxn
larouxn force-pushed the farewell_multi_json branch from 8b60fef to 8158b11 Compare June 19, 2026 21:44
@danarnold

Copy link
Copy Markdown

This would be nice for another reason: currently, elasticsearch-ruby emits multi_json deprecation warnings with multi_json >=1.21.0 since it uses the MultiJson constant instead of MultiJSON. This would avoid having to make fixes for multi_json like in elastic-transport-ruby elastic/elastic-transport-ruby#112 and elastic/elastic-transport-ruby#125.

@larouxn
larouxn force-pushed the farewell_multi_json branch from 8158b11 to f1e2762 Compare June 25, 2026 17:59
@larouxn

larouxn commented Jul 2, 2026

Copy link
Copy Markdown
Author

It appears jruby 9.3 does not agree with the modern json gem requirement seemingly due to its required Ruby version, which I believe is Ruby 2.6, being lower than modern json's, which is Ruby 2.7 (source). (CI logs)

Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    Ruby

    base64 was resolved to 0.3.0, which depends on
      Ruby (>= 2.4)

    bundler was resolved to 2.2.33, which depends on
      Ruby (>= 2.3.0)

    elasticsearch was resolved to 9.5.0, which depends on
      Ruby (>= 2.6)

    elasticsearch-api was resolved to 9.5.0, which depends on
      json (~> 2.19) was resolved to 2.20.0, which depends on
        Ruby (>= 2.7)

    ostruct was resolved to 0.6.3, which depends on
      Ruby (>= 2.5)

    yard was resolved to 0.9.44, which depends on
      Ruby (>= 1.8.7)

That said, jruby 9.3 has been EOL for two years (source). Maybe we can update CI? Would be glad to open a PR to remove 9.3/add newer jruby if that's something maintainers would be open to. PR opened: #3000.

image

@larouxn
larouxn force-pushed the farewell_multi_json branch from f1e2762 to 8a72531 Compare July 10, 2026 17:44
@larouxn

larouxn commented Jul 10, 2026

Copy link
Copy Markdown
Author

Let's get CI run and if it looks good merge #3000 then continue with this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants