toJson method

Map<String, Object> toJson()

Converts a Toleration instance to JSON data.

Implementation

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

  final tempEffect = effect;
  final tempKey = key;
  final tempOperator = operator;
  final tempTolerationSeconds = tolerationSeconds;
  final tempValue = value;

  if (tempEffect != null) {
    jsonData['effect'] = tempEffect;
  }

  if (tempKey != null) {
    jsonData['key'] = tempKey;
  }

  if (tempOperator != null) {
    jsonData['operator'] = tempOperator;
  }

  if (tempTolerationSeconds != null) {
    jsonData['tolerationSeconds'] = tempTolerationSeconds;
  }

  if (tempValue != null) {
    jsonData['value'] = tempValue;
  }

  return jsonData;
}