Note that there are some explanatory texts on larger screens.

plurals
  1. PODeserialize JsonObjects to .NET Objects
    primarykey
    data
    text
    <p>Attempting to deserialize the following JSON into a .NET object using Json.Net isn't working out as intended. Deserializing usually isn't a major complication, but the structure of the following JSON isn't as straight forward.</p> <p>JSON:</p> <pre><code>{ "33": { "0": { "StopName": "JFK Blvd &amp; 15th St", "Route": "33", "date": "11:24p", "day": "Fri", "Direction": "1", "DateCalender": "02/10/12 11:24 pm" }, "3": { "StopName": "JFK Blvd &amp; 15th St", "Route": "33", "date": "11:52p", "day": "Fri", "Direction": "1", "DateCalender": "02/10/12 11:52 pm" } }, "32": { "1": { "StopName": "JFK Blvd &amp; 15th St", "Route": "32", "date": "11:30p", "day": "Fri", "Direction": "1", "DateCalender": "02/10/12 11:30 pm" } }, "17": { "2": { "StopName": "JFK Blvd &amp; 15th St", "Route": "17", "date": "11:38p", "day": "Fri", "Direction": "1", "DateCalender": "02/10/12 11:38 pm" } } } </code></pre> <p>The complication results from "33", "32", "17" which represent route numbers. These numbers can change as the routes in the result set change.</p> <p>I'm sure I'll need to write a custom JSON converter for this, but I can't find any clear information on accomplishing this task (as no one seems to have a problem where the property name is dynamic).</p> <p>I attempted also to use JSON.NET Linq to JSON, but this isn't feasible because you need to use code similar to the following to access the JSON:</p> <pre><code>JObject o = JObject.Parse(e.Result); o["33"]; </code></pre> <p>Since I have no realistic idea what the property names are before hand I can't easily traverse this object it seems.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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