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

Make Currency json serializable #11

Open
LKay opened this issue Jul 12, 2019 · 0 comments
Open

Make Currency json serializable #11

LKay opened this issue Jul 12, 2019 · 0 comments

Comments

@LKay
Copy link

LKay commented Jul 12, 2019

Currency enum should be extending str as weel to make it serializable to json by default. Currently it results with the error:

TypeError: <Currency.USD: 'USD'> is not JSON serializable

Changing definition to this should solve the issue:

class Currency(str, Enum):
	...

And calling print(json.dumps(Currency.USD)) would correctly print: "USD".

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