Q:

Json DeserializeObject into class with dynamic property

I'm trying to convert a string of JSON data into a C# class object.  However I'm having an issue with a small part of the JSON which is dynamic in nature.  
The part of the JSON is below:
"contact": [{
    "comment": null,
    "type": {
        "id": "cell",
        "name": "Example name"
    },
    "preferred": true,
    "value": {
        "country": "7",
        "formatted": "+7 (702) 344-3423-3",
        "number": "3498908",
        "city": "702"
    }
},
{
    "type": {
        "id": "email",
        "name": "Email example"
    },
    "preferred": false,
    "value": "name@mail.com"
}]

C# classes
public class Value
{
    public string country { get; set; }
    public string formatted { get; set; }
    public string number { get; set; }
    public string city { get; set; }
}

public class Type
{
    public string id { get; set; }
    public string name { get; set; }
}

public class Contact
{
    public string comment { get; set; }
    public Type type { get; set; }
    public bool preferred { get; set; }
    public string value { get; set; }
}

C# Code
 Contact contact = JsonConvert. DeserializeObject<Contact>(result);

The format of "value" changes depending on the contact information.  Is it possible to map value both as a string and also class Value.  
Thanks for any help that can be provided.  

A:

You can literally just use dynamic, i.e.
public dynamic value { get; set; }

If it looks like an object, it will be materialized as a JObject, which can be used via the dynamic API, so .value.country will work, etc.  If it looks like an integer, bool or string: it will be materialized as such.  Arrays will also be handled suitably.  So: you can check whether .value is string, etc.  Note that this won't use your Value type, and doing so is more complex, but: meh; you get the data.  You can always switch that out manually. 
It will also behave like this if you use object instead of dynamic, but then it is harder to access the inner properties.