Converts the object to a JSON representation.
@override Map<String, dynamic> toJson() { return {type.name: value.toString()}; }