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

Don't know how to jsonify Complex #84

Open
markjreed opened this issue Dec 12, 2022 · 3 comments
Open

Don't know how to jsonify Complex #84

markjreed opened this issue Dec 12, 2022 · 3 comments

Comments

@markjreed
Copy link

So it seems like Complex should be in the list, but is there any way around this without modifying the code to JSON::Fast itself? The type handling appears to be all hard-coded. Seems like falling back to whatever the stringification is would make sense.

@2colours
Copy link

2colours commented May 5, 2023

Pretty sure JSON does not know complex numbers so there is no point in "jsonifying" them.

This module is not a serializer that uses JSON format under the hood - its very purpose is to convert from and to JSON-eligible data.

@timo
Copy link
Owner

timo commented May 10, 2023

@markjreed please check out the branch https://github.com/timo/json_fast/tree/converter_func and see if the proposed API can help with your issue

@markjreed
Copy link
Author

markjreed commented May 10, 2023

@2colours Well, I wasn't looking for a way to round-trip arbitrary types through JSON and have them come through unscathed, at least not without writing some extra code. Just looking for a way to hook in that extra code without rewriting the module.

@timo the converter_func branch works a treat, thanks!

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

3 participants