Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your json format :</p> <pre><code>{ "33": { &lt;-- This is MainRoute number "0": { &lt;-- This is SubRoute number and below are SubRoute properties "StopName": "JFK Blvd &amp; 15th St", "Route": "33", "date": "11:24p", "day": "Fri", "Direction": "1", "DateCalender": "02/10/12 11:24 pm" }, .... } </code></pre> <p>You can use <code>JObject</code> to parse your json data :</p> <pre><code>public class MainRoute { public int RouteNumber { get; set; } public IList&lt;SubRoute&gt; SubRoutes { get; set; } public MainRoute() { SubRoutes = new List&lt;SubRoute&gt;(); } } public class SubRoute { public int RouteNumber { get; set; } public string StopName { get; set; } public int Route { get; set; } [JsonProperty("date")] public string Date { get; set; } [JsonProperty("day")] public string Day { get; set; } public int Direction { get; set; } [JsonProperty("DateCalender")] public string DateCalendar { get; set; } } class Program { static void Main(string[] args) { string jsonString = FetchJsonData(); var routes = ParseRouteJsonString(jsonString); } static IEnumerable&lt;MainRoute&gt; ParseRouteJsonString(string jsonString) { JObject jsonObject = JObject.Parse(jsonString); foreach (KeyValuePair&lt;string, JToken&gt; pair in jsonObject) { var mainRoute = new MainRoute() { RouteNumber = Int32.Parse(pair.Key) // Get main route number. }; foreach (JProperty property in pair.Value) { var subRoute = property.Value.ToObject&lt;SubRoute&gt;(); subRoute.RouteNumber = Int32.Parse(property.Name); // Get sub route number. mainRoute.SubRoutes.Add(subRoute); } yield return mainRoute; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload