Add toMap() and toJson() methods to the task interface/base class.