Skip to content

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

Open
larouxn wants to merge 1 commit into
ruby-rdf:developfrom
larouxn:farewell_multi_json
Open

Replace multi_json and oj gems with standard Ruby json gem#64
larouxn wants to merge 1 commit into
ruby-rdf:developfrom
larouxn:farewell_multi_json

Conversation

@larouxn

@larouxn larouxn commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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

Generally it's a pretty simple swap and cleanup. That said, the one quirk comes from the fact that oj could apparently handle non-finite doubles such as infinity. As the Standard JSON (RFC 8259) does not support non-finite doubles such as NaN, Infinity, and -Infinity as numeric values, the JSON gem can raise a JSON::GeneratorError when passed such values for generation. Thus, I'm proposing we use string representation + type for such values. Open to opinions.

Probably worth reviewing with whitespace disabled re: the indentation changes in spec/api_spec.rb. Link below.

https://github.com/ruby-rdf/json-ld/pull/64/changes?w=1

Notes

Apparently v1.20.0 of multi_json dropped support for ok_json. 🤷‍♂️ 🔥

@CLAassistant

CLAassistant commented Jun 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@larouxn

larouxn commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Note that we either need to merge this or alternatively a smaller PR that just drops ok_json support since v1.20.0 of multi_json dropped support for ok_json which thus leads to CI here being broken.

PR to drop no-longer-supported serializers:

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