A multipurpose python flask API server and administration SPA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
444 B

from datetime import date
from typing import Any
import rfc3339
from flask.json import JSONEncoder
class CustomJSONEncoder(JSONEncoder):
def default(self, obj: Any) -> Any:
try:
if isinstance(obj, date):
return rfc3339.format(obj)
iterable = iter(obj)
except TypeError:
pass
else:
return list(iterable)
return JSONEncoder.default(self, obj)