Q:

Parsing Unknown JSON using JavascriptSerializer in C#

How can I use JavaScriptSerializer to parse some unknown dynamic JSON. In particular, I'm writing my own wrapper for the Google Calendar API. An event has an object called extendedProperties with both a private object and shared object containing an unknown set of properties:
"extendedProperties": {
    "private": {
        "UnknownKey1": "UnknownValue1",
        "UnknownKey2": "UnknownValue2",
        "UnknownKey3": "UnknownValue3"
    },
    "shared": {
        "UnknownKey1": "UnknownValue1",
        "UnknownKey2": "UnknownValue2",
        "UnknownKey3": "UnknownValue3"
    }
}

I want to create a class like this for the JavaScriptSerializer:
public class ExtendedProperties
{
    public ??? @private { get; set; }
    public ??? shared { get; set; }
}

Of course there are problems.
(1) Does the serializer understand the ampersand so it will parse the property 'private'?
(2) What would the return type be for the properties that the JavaScriptSerializer could read/write? Some sort of Dictionary?
Thanks in advance!

A:

var serializer = new JavaScriptSerializer();
var jsonObject = serializer.Deserialize<IDictionary<string, object>>(jsonStr);

I have used this code to deserialize unknown json objects. 

