How to convert JSON to C# classes?

后端 未结 4 1954

I have a complex JSON object that I want represent as C# class. I have a head start on the parent class called \"Form\", but how can I represent a collection for different t

4条回答
  •  情深已故
    2020-12-19 07:23

    Wow. Fascinating question. Maybe use ExpandoObject / dynamic?

    http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject.aspx

    http://blogs.msdn.com/b/csharpfaq/archive/2009/10/01/dynamic-in-c-4-0-introducing-the-expandoobject.aspx?PageIndex=4

    Or anonymous types I think are serializable with the built-in .NET JSON serializer.

提交回复
热议问题