Skip to content

Commit

Permalink
ignoring null values in json response
Browse files Browse the repository at this point in the history
  • Loading branch information
quirijnslings committed Sep 5, 2024
1 parent 19fe12b commit 290ab6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Bynder/Sdk/Api/RequestSender/ApiRequestSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,15 @@ public async Task<T> SendRequestAsync<T>(Request<T> request)
{
return default;
}
// Note: for powerpoints, a pdf is automatically generated by Bynder and stored as a second MediaItem.
// However, this MediaItem has a Height and Width of null, which cannot be converted to an int so it breaks.
// The below setting fixes this
var settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};

return JsonConvert.DeserializeObject<T>(responseString);
return JsonConvert.DeserializeObject<T>(responseString, settings);
}

private async Task<HttpResponseMessage> CreateHttpRequestAsync<T>(Request<T> request)
Expand Down

0 comments on commit 290ab6c

Please sign in to comment.