is there object generator working on JSON ? (just like XSDObjectGen.exe)

354 Views Asked by At

I have to serialize & desserialize json data.

if the data type was XSD, I am able to create class by using XSDObjectGen.exe

But ,

the data type I have to serialize is 'JSON'.

Is there any good way to generate class for serialize & deserialize ?

2

There are 2 best solutions below

0
On BEST ANSWER

There is a JSONDataSerializer, but it is some obscure assembly. (Maybe the ASP.NET extensions?)

0
On
using System.Web.Script.Serialization;

...

JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

string payload = javaScriptSerializer.Serialize(myObject);
//or
string payload = javaScriptSerializer.Serialize(new object[] { myObject.Id });