You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
The py-to-json conversion table specifies that dict keys must be of a basic type:
str
,int
,float
,bool
orNone
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 astr
.The text was updated successfully, but these errors were encountered: