Json is one of the popular format these days, and if you are trying to deserialize a JSON string to C# classes, You can automatically create C# classes against the json string using
json2csharp . Following is one of the Json format and the c# classes it automatically generates.
{ "Glossary": { "Title": "example glossary", "GlossDiv": { "Title": "S", "Id": 1235434, "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } }
public class GlossDef
{
public string para { get; set; }
public List GlossSeeAlso { get; set; }
}
public class GlossEntry
{
public string ID { get; set; }
public string SortAs { get; set; }
public string GlossTerm { get; set; }
public string Acronym { get; set; }
public string Abbrev { get; set; }
public GlossDef GlossDef { get; set; }
public string GlossSee { get; set; }
}
public class GlossList
{
public GlossEntry GlossEntry { get; set; }
}
public class GlossDiv
{
public string Title { get; set; }
public int Id { get; set; }
public GlossList GlossList { get; set; }
}
public class Glossary
{
public string Title { get; set; }
public GlossDiv GlossDiv { get; set; }
}
public class RootObject
{
public Glossary Glossary { get; set; }
}