added custom json encoder for datetime objects and (unintentional) code formatting