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

How to use both, pure and ext variant #523

Open
mrckzgl opened this issue Mar 16, 2023 · 0 comments
Open

How to use both, pure and ext variant #523

mrckzgl opened this issue Mar 16, 2023 · 0 comments

Comments

@mrckzgl
Copy link

mrckzgl commented Mar 16, 2023

Hi,

(until fix for #515 gets released,) we want to use the pure variant to pretty generate some of our json (where it is important to have correct formatting), however for everything else the ext variant is preferred, as it is faster.
Two problems arise with this:

  1. I haven't figured out in the docs how to explicitly use a specific variant while both are loaded. There is only one global object JSON which exposes the pretty_generate function. JSON::Ext or JSON::Pure do not. So how to explicitly call json pure pretty_generate?
  2. Whatever order I do the imports: require "json/ext" / require "json/pure", in both cases JSON::Generator resolves to JSON::Pure::Generator. How to load both variants and let JSON::Ext::Generator be the default?
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

No branches or pull requests

1 participant