toJson method

  1. @override
Map<String, dynamic> toJson()

Converts this class object into a JSON value.

Implementation

@override
Map<String, dynamic> toJson() {
  final result = {
    "href": href.toString(),
    ...additionalFields,
  };

  if (subprotocol != null) {
    result["subprotocol"] = subprotocol;
  }

  final op = this.op;
  if (op != null) {
    result["op"] =
        op.map((opValue) => opValue.toString()).toList(growable: false);
  }

  if (contentType != _defaultContentType) {
    result["contentType"] = contentType;
  }

  if (contentCoding != null) {
    result["contentCoding"] = contentCoding;
  }

  if (security != null) {
    result["security"] = security;
  }

  if (scopes != null) {
    result["scopes"] = scopes;
  }

  final response = this.response;
  if (response != null) {
    result["response"] = response.toJson();
  }

  final additionalResponses = this.additionalResponses;
  if (additionalResponses != null) {
    result["additionalResponses"] = additionalResponses
        .map((additionalResponse) => additionalResponse.toJson())
        .toList(growable: false);
  }

  return result;
}