toJson method

Map<String, Object> toJson()

Converts a Subject instance to JSON data.

Implementation

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

  final tempGroup = group;
  final tempKind = kind;
  final tempServiceAccount = serviceAccount;
  final tempUser = user;

  if (tempGroup != null) {
    jsonData['group'] = tempGroup.toJson();
  }

  jsonData['kind'] = tempKind;

  if (tempServiceAccount != null) {
    jsonData['serviceAccount'] = tempServiceAccount.toJson();
  }

  if (tempUser != null) {
    jsonData['user'] = tempUser.toJson();
  }

  return jsonData;
}