Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options in Oj #178

Closed
wants to merge 1 commit into from
Closed

Options in Oj #178

wants to merge 1 commit into from

Conversation

stereobooster
Copy link

@stereobooster stereobooster commented May 6, 2017

WIP. Need to decide what to do with new Oj gem.

New Oj has json compatibility mode e.g. it is identical to original JSON gem. Which should be used here, buut in this mode Oj only accept options valid for JSON, nothing else. So this can be brake change for developer who used some special options for Oj.

PS Do we need compatibility with version 2.x?

Related ohler55/oj#376 cc @ohler55

@ohler55
Copy link

ohler55 commented May 6, 2017

Looks like the tests are using an older Oj. I think the Gemspec needs to be updated.

@stereobooster
Copy link
Author

On the second thought those changes don't make much sense.

defaults :load, :mode => :strict, :symbolize_keys => false - strict is ideal for loading, because this is just JSON-specification compatibility mode. symbolize_keys is still makes sense, even so this is invalid option in JSON gem.

defaults :dump, :mode => :compat, :time_format => :ruby, :use_to_json => true - compat is the same as json in new Oj. I suppose time_format is useless with new Oj, but we can leave it for backward compatibility.

@stereobooster stereobooster deleted the oj-3 branch May 6, 2017 19:01
@rwz
Copy link
Member

rwz commented May 6, 2017

Wait, why do we need MultiJson support the Oj's compatibility mode again? I don't get it.

You can use Oj's hack to speed-up code that uses stdlib JSON and also enable MultiJson's Oj adapter to make sure that MultiJson is doing the right thing.

@stereobooster
Copy link
Author

Just a small note Oj 3 in compat mode ignores use_to_json AFAIK

@ohler55
Copy link

ohler55 commented May 19, 2017

That is correct. It is as if use_to_json is always true or rather it follows the json gem rules for when to_json is called. This table http://www.ohler.com/oj/doc/file.Modes.html explains what options are applicable.

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.

3 participants