I’m trying to deserialize an object which was generated by LinqToSql. The user is allowed to edit the data of the object in the view and then it gets posted back to the controller. The edited Data comes in JSON. How does this action have to look like?
Something like…
public ActionResult(JsonObject json)
{
MyClass c = Jsonify(json) as MyClass;
}
Is there a nice helpful static class in the framework I’m missing? Or do I have to create a DataContract?
Many thanks
System.Web.Script.Serialization.JavaScriptSerializer
EDIT: Oops…just noticed you are passing an object instead of string….so you will need to use System.Runtime.Serialization.Json.DataContractJsonSerializer: