Allow the JSON library to load available variant #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I'm having some downstream issues due to the way the JSON library is getting
loaded in your code (sparkleformation/sfn#178). Due to other libraries also loading
JSON and the ext variant being available, both variants end up being loaded. As a result
TypeErrors are encountered:
I tracked down an issue in the JSON repository (ruby/json#269) that describes the
issue and from local testing it appears the underlying problem is a conflict between
the two implementations where each provides a subset of the entire functionality. The
result ends up being failures to generate JSON output depending on the data types. The
Fixnum
type is an easy one to see fail.From the documentation of the json project site (https://github.com/flori/json):
This is a bit more explanatory than the README file. Since the library will automatically
fallback to the pure variant if available, using
require 'json'
in both places is perfectlyacceptable to get the desired results. The loading bit can be seen here:
https://github.com/flori/json/blob/master/lib/json.rb#L57-L62
This would fix the issue for a number of downstream libraries and applications and
would be much appreciated to get merged and released when you can.
Thanks!