Unwrapping a wrapped array

Aug 8, 2012 at 3:08 PM

I'm working with a web service that returns JSon like what's shown below. It's really just an array of typenames but every entry is presented as a key-value-pair with the type as the key and the value as the object. I've succeeded in deserializing this like:

Dictionary<string,typename>[] typenames = JsonConvert.DeserializeObject<Dictionary<string, Typename>[]>(jsonResponse);

However then I have to traverse the dictionary and unwrap the objects into an array. Is there a way to do this in one step?

 

[

{ "typename" :

   { "field1" : "value1",

     "field2" : value2", }

 },

{ "typename" :

{ "field1" : "value1",

"field2" : value2", }

}

]