using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace SuperCms.Models { public class ConnTelco { public String id { get; set; } public String telcoCode { get; set; } public String telcoName { get; set; } public String sequence { get; set; } public String timeDiff { get; set; } public override string ToString() { return JsonConvert.SerializeObject(this); } public ConnTelco() { } public ConnTelco(string json) : this(JObject.Parse(json)) { } public ConnTelco(JObject jObject) { if (jObject != null) { id = (string)jObject["ID"]; telcoCode = (string)jObject["TELCO_CODE"]; telcoName = (string)jObject["TELCO_NAME"]; sequence = (string)jObject["SEQUENCE"]; timeDiff = (string)jObject["TIME_DIFF"]; } } } public class ConnTelcos { [JsonProperty("data")] public List data { get; set; } public override string ToString() { return JsonConvert.SerializeObject(this); } public ConnTelcos() { } public ConnTelcos(string json) : this(JObject.Parse(json)) { } public ConnTelcos(JObject jObject) { if (jObject != null) { var list = jObject["data"]; if (list != null && list.HasValues) { data = new List(); JArray a = (JArray)list; foreach (JObject o in a.Children()) { data.Add(new ConnTelco(o)); } } } } } }