toJson method

Map<String, Object> toJson()

Converts a SubjectAccessReviewSpec instance to JSON data.

Implementation

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

  final tempExtra = extra;
  final tempGroups = groups;
  final tempNonResourceAttributes = nonResourceAttributes;
  final tempResourceAttributes = resourceAttributes;
  final tempUid = uid;
  final tempUser = user;

  if (tempExtra != null) {
    jsonData['extra'] = tempExtra;
  }

  if (tempGroups != null) {
    jsonData['groups'] = tempGroups;
  }

  if (tempNonResourceAttributes != null) {
    jsonData['nonResourceAttributes'] = tempNonResourceAttributes.toJson();
  }

  if (tempResourceAttributes != null) {
    jsonData['resourceAttributes'] = tempResourceAttributes.toJson();
  }

  if (tempUid != null) {
    jsonData['uid'] = tempUid;
  }

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

  return jsonData;
}