I'm having trouble with de-serializing an API response. The response returns an object. One of the property's in that object can either be a boolean or an object. When de-serializing it in C# I get an de-serialization error. How do i differentiate between the two data types?
Deserializer:
JsonSerializer.Deserialize<IEnumerable<ApiResponse>>(response)
ApiResponse Object:
public class ApiResponse
{
[JsonPropertyName("site")]
public bool SiteBool { get; set; }
[JsonPropertyName("site")]
public SiteObject Site { get; set; }
}
public class SiteObject
{
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("url")]
public string Url { get; set; }
}