Closed elonzh closed 11 months ago
Hello @elonzh, could you please provide an example of this error when using the App Store Server API client?
Here is an example:
import json
from appstoreserverlibrary.models.AutoRenewStatus import AutoRenewStatus
from enum import IntEnum
class AutoRenewStatusWithInt(IntEnum):
"""
The renewal status for an auto-renewable subscription.
https://developer.apple.com/documentation/appstoreserverapi/autorenewstatus
"""
OFF = 0
ON = 1
# OK
print(json.dumps({
"status": AutoRenewStatusWithInt.ON
}))
# TypeError: Object of type AutoRenewStatus is not JSON serializable
print(json.dumps({
"status": AutoRenewStatus.ON
}))
Currently, the package defines enums by inheriting
enum.Enum
class, this will causeTypeError
when serializing it to json without a default function.See: