JavaScriptSerializer C# and Generics (newbie mistakes I think!)
<p>WinForms C#.. am getting some JSON in the format below (bottom of message) and trying to deserialise using:</p>

<p>using System.Web.Script.Serialization;</p>

<p>When I had simply this json returned:</p>

<pre><code>{
"objects": [
    {
        "categoryid": "1",
        "name": "funny",
        "serverimageid": "1",
        "dateuploaded": "2008-11-17 16:16:41",
        "enabled": "1"
    },
    {
        "categoryid": "2",
        "name": "happy",
        "serverimageid": "2",
        "dateuploaded": "2008-11-17 16:17:00",
        "enabled": "1"
    },
    {
        "categoryid": "3",
        "name": "sad",
        "serverimageid": "3",
        "dateuploaded": "2008-11-16 16:17:13",
        "enabled": "1"
    }
]
}
</code></pre>

<p>Then is was easy to deserialize: (yikes.. a bit hacky)</p>

<pre><code>// s is the string
s = s.Remove(0, 11);
// last }
int stringLength = s.Length;
s = s.Remove(stringLength - 1, 1);

listOfCategories = serializer1.Deserialize&lt;List&lt;Category&gt;&gt;(s);
</code></pre>

<p>Where</p>

<pre><code>public class Category
    {
        public int categoryID;
        public string name;
        public int imageID;
        public DateTime dateUpdated;
        public int isActive;
        public int displayOrder;
    }
</code></pre>

<p>However now, I'm stuck!  Have tried a list of lists... but can't get anywhere..</p>

<p>Much appreciated any help.</p>

<pre><code>{
    "objects": {
        "categories": [
            {
                "name": "Congratulations",
                "imageID": "1",
                "isActive": "1",
                "displayOrder": "0",
                "dateUpdated": "2008-11-27 00:00:00"
            },
            {
                "name": "Animals",
                "imageID": "2",
                "isActive": "1",
                "displayOrder": "0",
                "dateUpdated": "2008-11-26 00:00:00"
            },
            {
                "name": "Romance",
                "imageID": "3",
                "isActive": "1",
                "displayOrder": "0",
                "dateUpdated": "2008-11-24 00:00:00"
            }
        ],
        "present": [
            {
                "presentID": "1",
                "name": "Tiger",
                "categoryID": "2",
                "imageID": "1",
                "dateUpdated": "2008-11-27",
                "isActive": "1",
                "isAnimated": null,
                "isInteractive": null,
                "isAdaptive": null,
                "webLinkURL": null
            },
            {
                "giphtID": "2",
                "name": "Donkey",
                "categoryID": "2",
                "imageID": "2",
                "dateUpdated": "2008-11-27",
                "isActive": "1",
                "isAnimated": null,
                "isInteractive": null,
                "isAdaptive": null,
                "webLinkURL": null
            },
            {
                "giphtID": "3",
                "name": "Elephant",
                "categoryID": "2",
                "imageID": "3",
                "dateUpdated": "2008-11-27",
                "isActive": "1",
                "isAnimated": null,
                "isInteractive": null,
                "isAdaptive": null,
                "webLinkURL": null
            }
        ]
    }
}
</code></pre>
