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 ?
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 ?
There is a JSONDataSerializer
, but it is some obscure assembly. (Maybe the ASP.NET extensions?)
using System.Web.Script.Serialization;
...
JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
string payload = javaScriptSerializer.Serialize(myObject);
//or
string payload = javaScriptSerializer.Serialize(new object[] { myObject.Id });