public static string SerializeToJSON
{
System.Web.Script.Serialization.JavaScriptSerializer scriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
StringBuilder jsonBuilder = new StringBuilder();
scriptSerializer.Serialize(obj, jsonBuilder);
return jsonBuilder.ToString();
}
And it is quite straightforward to deserialise the JSON string into the original object instance
OriginalType obj = (new System.Web.Script.Serialization.JavaScriptSerializer()).Deserialize
No comments:
Post a Comment