using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace SuperAdmin.Models.Object { public class Province { public String id { get; set; } public String name { get; set; } public String code { get; set; } public Province(string id, string name, string code) { this.id = id; this.name = name; this.code = code; } public Province() { } public Province(string json) : this(JObject.Parse(json)) { } public Province(JObject jObject) { if (jObject != null) { id = (string)jObject["id"]; name = (string)jObject["name"]; code = (string)jObject["code"]; } } } public class Provinces { public List data { get; set; } public Provinces() { } public Provinces(string json) : this(JObject.Parse(json)) { } public Provinces(JObject jObject) { if (jObject != null) { var list = jObject["listProvice"]; if (list != null && list.HasValues) { data = new List(); JArray a = (JArray)list; foreach (JObject o in a.Children()) { data.Add(new Province(o)); } } } } } }