Newbie: Most efficient way to deserialize?

Oct 14, 2008 at 12:57 PM
Hi,

I am a complete newbie to Json.NET, but wanted to find out the fastest way to deserialize an object. I need a way to access an object as though it was a dictionary, so that I can enumerate its keys to discover its values.

For example:

IDictionary<string, object> myObject = ???
foreach (string key in myObject.Keys)
{
    object value = myObject.Values[key];
    response.Write(value != null ? value.GetType().Name : "null");
}

Thanks,
Lea Hayes
Coordinator
Oct 27, 2008 at 9:06 AM
Edited Oct 27, 2008 at 9:07 AM
The most efficient way to learn is to read the documentation.

JObject implements IDictionary.
Nov 21, 2008 at 10:44 PM
'Newtonsoft.Json.Linq.JObject' does not contain a definition for 'Keys'

JObject sure doesn't seem to implement IDictionary. Thanks for the helpful example, though.