Open LKay opened 5 years ago
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"
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"
.