How can I deserialize JSON to a simple Dictionary in ASP.NET?

前端 未结 21 2807
粉色の甜心
粉色の甜心 2020-11-21 06:33

I have a simple key/value list in JSON being sent back to ASP.NET via POST. Example:

{ \"key1\": \"value1\", \"key2\": \"value2\"}

21条回答
  •  误落风尘
    2020-11-21 07:19

    Mark Rendle posted this as a comment, I wanted to post it as an answer since it's the only solution that has worked so far to return the success and the error-codes json results from the Google reCaptcha response.

    string jsonReponseString= wClient.DownloadString(requestUrl);    
    IDictionary dict = new JavaScriptSerializer().DeserializeObject(jsonReponseString) as IDictionary;
    

    Thanks again, Mark!

提交回复
热议问题