Deserializing JSON Object Array with Json.net

You can create a new model to Deserialize your JSON CustomerJson:

    public class CustomerJson
    {
        [JsonProperty("customer")]
        public Customer Customer { get; set; }
    }

    public class Customer
    {
        [JsonProperty("first_name")]
        public string Firstname { get; set; }

        [JsonProperty("last_name")]
        public string Lastname { get; set; }

        ...
    }

And you can deserialize your JSON easily:

JsonConvert.DeserializeObject<List<CustomerJson>>(json);

Documentation: Serializing and Deserializing JSON

Leave a Comment