Serialise datetimes to JSON