This project has moved and is read-only. For the latest updates, please go here.

Deserialize Json Array

May 24, 2010 at 9:56 PM
So I have a Json string that looks like the following: string json = "{"GP":[{"description":"715 COMPRESSOR STATION","parent":"GULF PLAINS AREA"}, {"description":"719 COMPRESSOR STATION","parent":"GULF PLAINS AREA",}], "GUA":[{"description":"GUADALUPE PIPELINE","parent":"GUADAREA"}]}" And I'm having a helluva time trying to figure out how to deserialize this object. I have a Location class that defines the description and parent fields. With this, I tried: List<Location> locs = JsonConvert.DeserializeObject<List<Location>(json); But when I tried this, I get an error message that says: "Cannot deserialize JSON object into type 'System.Collections.Generic.List'1'" If anybody could post any suggestions, I would greatly appreciate it. Thanks!