We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currency enum should be extending str as weel to make it serializable to json by default. Currently it results with the error:
str
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".
print(json.dumps(Currency.USD))
"USD"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currency enum should be extending
str
as weel to make it serializable to json by default. Currently it results with the error:Changing definition to this should solve the issue:
And calling
print(json.dumps(Currency.USD))
would correctly print:"USD"
.The text was updated successfully, but these errors were encountered: