Как десериализировать Json в Class с помощью Newtonsoft. Если элемент Json может быть как String и быть как составной объект

Есть следующий код Json

{
"contact": [
    {
        "verified": true,
        "comment": null,
        "type": {
            "id": "cell",
            "name": "Мобильный телефон"
        },
        "preferred": true,
        "value": {
            "country": "7",
            "city": "123",
            "number": "4567890",
            "formatted": "+71234567890"
        }
    },
    {
        "type": {
            "id": "email",
            "name": "Эл. почта"
        },
        "preferred": false,
        "value": "[email protected]"
    }
]}

И частично написанный class для десериализации

public class HrImportCandidateResponse
{
    [JsonProperty("contact")]
    public HrImportCandidateContact[] Contact { get; set; }
}

public class HrImportCandidateContact
{
    [JsonProperty("verified")]
    public bool Verified { get; set; }
    [JsonProperty("comment")]
    public string Comment { get; set; }
    [JsonProperty("type")]
    public HrImportCandidateContactType Type { get; set; }
    [JsonProperty("preferred")]
    public bool Preferred { get; set; }
    [JsonProperty("value")]
    public HrImportCandidateContactValue Value { get; set; }
}

public class HrImportCandidateContactType
{
    [JsonProperty("id")]
    public string Id { get; set; }
    [JsonProperty("name")]
    public string Name { get; set; }
}

public class HrImportCandidateContactValue
{
    [JsonProperty("country")]
    public string Country { get; set; }
    [JsonProperty("city")]
    public string City { get; set; }
    [JsonProperty("number")]
    public string Number { get; set; }
    [JsonProperty("formatted")]
    public string Formatted { get; set; }
}

Вопрос в том как сказать десериализатору Newtonsoft
Что у объекта contact может два разных типа объекта.
Где type.id = cell там у него value объект.
Где type.id = email там у него value string.


Ответы (0 шт):