diff --git a/src/Pipedrive.net/Converters/CustomFieldConverter.cs b/src/Pipedrive.net/Converters/CustomFieldConverter.cs index 0edbce8d..ccfe5d55 100644 --- a/src/Pipedrive.net/Converters/CustomFieldConverter.cs +++ b/src/Pipedrive.net/Converters/CustomFieldConverter.cs @@ -181,6 +181,11 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s var property_name = property.PropertyName; var property_value = property.ValueProvider.GetValue(value); + if(property.NullValueHandling == NullValueHandling.Ignore && property_value == null) + { + continue; + } + writer.WritePropertyName(property_name); if (property.Converter != null && property.Converter.CanWrite) { diff --git a/src/Pipedrive.net/Models/Request/Deals/DealUpdate.cs b/src/Pipedrive.net/Models/Request/Deals/DealUpdate.cs index aacee82f..40ce603e 100644 --- a/src/Pipedrive.net/Models/Request/Deals/DealUpdate.cs +++ b/src/Pipedrive.net/Models/Request/Deals/DealUpdate.cs @@ -9,56 +9,56 @@ namespace Pipedrive [JsonConverter(typeof(CustomFieldConverter))] public class DealUpdate : IEntityWithCustomFields { - [JsonProperty("title")] + [JsonProperty("title", NullValueHandling=NullValueHandling.Ignore)] public string Title { get; set; } - [JsonProperty("value")] + [JsonProperty("value", NullValueHandling=NullValueHandling.Ignore)] public decimal? Value { get; set; } - [JsonProperty("currency")] + [JsonProperty("currency", NullValueHandling=NullValueHandling.Ignore)] public string Currency { get; set; } - [JsonProperty("user_id")] + [JsonProperty("user_id", NullValueHandling=NullValueHandling.Ignore)] public long? UserId { get; set; } - [JsonProperty("person_id")] + [JsonProperty("person_id", NullValueHandling=NullValueHandling.Ignore)] public long? PersonId { get; set; } - [JsonProperty("org_id")] + [JsonProperty("org_id", NullValueHandling=NullValueHandling.Ignore)] public long? OrgId { get; set; } - [JsonProperty("stage_id")] + [JsonProperty("stage_id", NullValueHandling=NullValueHandling.Ignore)] public long? StageId { get; set; } - [JsonProperty("status")] + [JsonProperty("status", NullValueHandling=NullValueHandling.Ignore)] [JsonConverter(typeof(StringEnumConverter))] public DealStatus? Status { get; set; } - [JsonProperty("probability")] + [JsonProperty("probability", NullValueHandling=NullValueHandling.Ignore)] public double? Probability { get; set; } - [JsonProperty("lost_reason")] + [JsonProperty("lost_reason", NullValueHandling=NullValueHandling.Ignore)] public string LostReason { get; set; } - [JsonProperty("visible_to")] - public Visibility VisibleTo { get; set; } + [JsonProperty("visible_to", NullValueHandling=NullValueHandling.Ignore)] + public Visibility? VisibleTo { get; set; } - [JsonProperty("add_time")] + [JsonProperty("add_time", NullValueHandling=NullValueHandling.Ignore)] public DateTime? AddTime { get; set; } - [JsonProperty("close_time")] + [JsonProperty("close_time", NullValueHandling=NullValueHandling.Ignore)] public DateTime? CloseTime { get; set; } - [JsonProperty("lost_time")] + [JsonProperty("lost_time", NullValueHandling=NullValueHandling.Ignore)] public DateTime? LostTime { get; set; } - [JsonProperty("first_won_time")] + [JsonProperty("first_won_time", NullValueHandling=NullValueHandling.Ignore)] public DateTime? FirstWonTime { get; set; } - [JsonProperty("won_time")] + [JsonProperty("won_time", NullValueHandling=NullValueHandling.Ignore)] public DateTime? WonTime { get; set; } - [JsonProperty("expected_close_date")] + [JsonProperty("expected_close_date", NullValueHandling=NullValueHandling.Ignore)] public DateTime? ExpectedCloseDate { get; set; } [JsonIgnore]