Converts the object back to JSON map.
Map<String, dynamic> toJson() => { 'name': name?.value, 'threshold': threshold, };