toJson method

Map<String, Object> toJson()

Converts a APIGroupList instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempApiVersion = apiVersion;
  final tempGroups = groups;
  final tempKind = kind;

  if (tempApiVersion != null) {
    jsonData['apiVersion'] = tempApiVersion;
  }

  jsonData['groups'] =
      tempGroups.map((e) => e.toJson()).toList(growable: false);

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

  return jsonData;
}