Deserialize JSON string to c# object

后端 未结 6 2080
轻奢々
轻奢々 2020-12-10 01:15

My Application is in Asp.Net MVC3 coded in C#. This is what my requirement is. I want an object which is in the following format.This object should be achieved when I deseri

6条回答
  •  醉梦人生
    2020-12-10 02:07

    I believe you are looking for this:

    string str = "{\"Arg1\":\"Arg1Value\",\"Arg2\":\"Arg2Value\"}";
    JavaScriptSerializer serializer1 = new JavaScriptSerializer();
    object obje = serializer1.Deserialize(str, obj1.GetType());
    

提交回复
热议问题