Hi,
I have the following typescript:
export enum ResponseCode {
OK = 'OK',
ERROR = 'ERROR',
NOT_LOGGED_IN = 'NOT_LOGGED_IN',
}
The conversion is:
class ResponseCode(Enum):
OK = 'OK'
ERROR = 'ERROR'
NOT_LOGGED_IN = 'NOT_LOGGED_IN'
The result cannot be serialized into json using standard tools as Enum is not serializable.
TypeError: Object of type ResponseCode is not JSON serializable
For integers the IntEnum can be used as base class and is working.
For string based enums, the following is working:
class ResponseCode(str, Enum):
OK = 'OK'
ERROR = 'ERROR'
NOT_LOGGED_IN = 'NOT_LOGGED_IN'
Please consider supporting.
Thanks!
Hi,
I have the following typescript:
The conversion is:
The result cannot be serialized into json using standard tools as
Enumis not serializable.For integers the
IntEnumcan be used as base class and is working.For string based enums, the following is working:
Please consider supporting.
Thanks!