def my_decoder(obj):
    if '__type__' in obj:
        if obj['__type__'] == '__datetime__':
            return datetime.fromtimestamp(obj['epoch'])
return obj

def my_dumps(obj):
    return json.dumps(obj, cls=MyEncoder)

def my_loads(obj):
    return json.loads(obj, object_hook=my_decoder)
Celery: есть ли способ написать собственный JSON Encoder/Decoder?