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

coerce_keys option #29

Closed
lidatong opened this issue Nov 4, 2018 · 1 comment
Closed

coerce_keys option #29

lidatong opened this issue Nov 4, 2018 · 1 comment

Comments

@lidatong
Copy link
Owner

lidatong commented Nov 4, 2018

The py-to-json conversion table specifies that dict keys must be of a basic type: str, int, float, bool or None

However in practical usage, it's quite convenient to have objects as dictionary keys (especially, in lieu of data classes, leveraging the frozen=True option). Having the basic type restriction on keys makes encoding unnecessarily boilerplate-y.

Creating this issue for a potential coerce_keys kwarg to add to the public api. This gives the user the option of supplying a function to coerce non-basic type keys into a str.

@lidatong
Copy link
Owner Author

lidatong commented Jul 7, 2019

on reflection, this doesn't really seem like a compelling use-case

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