Implement toJson and fromJson methods for Task