public object Deconstruct(string jsonObject) { System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); DragDropPayload ret = new DragDropPayload(); ret = jss.Deserialize<DragDropPayload>(jsonObject); return ret; }
static void Main(string[] args) { //What Dashboard would say: IMessage msg = new DragDropPayload(Constants.operations.DragDrop, "Porsche", "RPC-21-4A1A-37CB-0A43-4E99-BEE9-D0D6-E68A-CD41-00"); string serialized = msg.Construct(); Console.WriteLine(serialized); Console.WriteLine("\n"); //System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); //DragDropPayload rcvd; ////object o = new object(); //rcvd = jss.Deserialize <DragDropPayload>(msg.Construct()); IMessage msg2 = new DragDropPayload(); msg2 = msg2.Deconstruct(serialized) as DragDropPayload; string serialized2 = msg2.Construct(); Console.WriteLine(serialized2); }