Converts to Json.
Json serialization support for json_serializable with @JsonSerializable.
json_serializable
@JsonSerializable
Object? toJson(Object? Function(T) toJsonT);