mirror of
https://github.com/Screenly/Anthias.git
synced 2026-05-05 22:05:14 -04:00
10 lines
282 B
Python
10 lines
282 B
Python
import json
|
|
|
|
def handler(obj):
|
|
if hasattr(obj, 'isoformat'):
|
|
return obj.isoformat()
|
|
else:
|
|
raise TypeError, 'Object of type %s with value of %s is not JSON serializable' % (type(obj), repr(obj))
|
|
|
|
def json_dump(obj):
|
|
return json.dumps(obj, default=handler) |