using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BusinessLayer { public class Outlet { public string id { get; set; } public string key { get; set; } public string title { get; set; } } public class Service { public string type { get; set; } public string id { get; set; } public string key { get; set; } public string title { get; set; } public List<Outlet> outlets { get; set; } } public class Image { public string pid { get; set; } } public class DisplayTitles { public string title { get; set; } public string subtitle { get; set; } } public class Service2 { public string type { get; set; } public string id { get; set; } public string key { get; set; } public string title { get; set; } } public class Ownership { public Service2 service { get; set; } } public class Image2 { public string pid { get; set; } } public class Image3 { public string pid { get; set; } } public class Service3 { public string type { get; set; } public string id { get; set; } public string key { get; set; } public string title { get; set; } } public class Ownership2 { public Service3 service { get; set; } } public class Programme3 { public string type { get; set; } public string pid { get; set; } public string title { get; set; } public object position { get; set; } public Image3 image { get; set; } public object expected_child_count { get; set; } public string first_broadcast_date { get; set; } public Ownership2 ownership { get; set; } } public class Programme2 { public string type { get; set; } public string pid { get; set; } public string title { get; set; } public int position { get; set; } public Image2 image { get; set; } public int expected_child_count { get; set; } public string first_broadcast_date { get; set; } public Programme3 programme { get; set; } } public class Programme { public string type { get; set; } public string pid { get; set; } public int? position { get; set; } public string title { get; set; } public string short_synopsis { get; set; } public string media_type { get; set; } public int duration { get; set; } public Image image { get; set; } public DisplayTitles display_titles { get; set; } public string first_broadcast_date { get; set; } public Ownership ownership { get; set; } public Programme2 programme { get; set; } public bool is_available_mediaset_pc_sd { get; set; } public bool is_legacy_media { get; set; } } public class Broadcast { public bool is_repeat { get; set; } public bool is_blanked { get; set; } public string schedule_date { get; set; } public string start { get; set; } public string end { get; set; } public int duration { get; set; } public Service service { get; set; } public Programme programme { get; set; } } public class RootObject { public int page { get; set; } public int total { get; set; } public int offset { get; set; } public List<Broadcast> broadcasts { get; set; } // how can i get this list } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BusinessLayer; using Newtonsoft.Json; using System.Web.Script.Serialization; namespace WebApplication { public partial class GetJSon : System.Web.UI.Page { JsonBL bl = new JsonBL(); RootObject oRootObject = new RootObject(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string url = "http://www.abc.co.uk/tv/programmes/genres/drama/scifiandfantasy/schedules/upcoming.json"; string strJSon = bl.JSonData(url); JavaScriptSerializer oJS = new JavaScriptSerializer(); oRootObject = oJS.Deserialize<RootObject>(strJSon); } } public void GetData() { //list<boardcast> code } } }
System.Reflection
System.Reflection.Emit
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)