toJson method

Map<String, Object> toJson()

Converts a PolicyRulesWithSubjects instance to JSON data.

Implementation

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

  final tempNonResourceRules = nonResourceRules;
  final tempResourceRules = resourceRules;
  final tempSubjects = subjects;

  if (tempNonResourceRules != null) {
    jsonData['nonResourceRules'] =
        tempNonResourceRules.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempResourceRules != null) {
    jsonData['resourceRules'] =
        tempResourceRules.map((e) => e.toJson()).toList(growable: false);
  }

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

  return jsonData;
}