ASP.Net MVC: how to create a JsonResult based on raw Json Data

前端 未结 3 1413
有刺的猬
有刺的猬 2020-12-16 19:29

Having a string containing the following raw Json data (simplified for the sake of the question):

  var MyString =  \"{ \'val\': \'apple\' }\";
         


        
3条回答
  •  抹茶落季
    2020-12-16 19:44

    I think you can use the JavaScriptSerializer class for this

    var js = new System.Web.Script.Serialization.JavaScriptSerializer();
    var jsonObject = js.Deserialize("{ 'val': 'apple' }", typeof(object));
    

提交回复
热议问题