Json字符串转Dictionary

  /// <summary>
    /// json字符串转Dictionary
    /// </summary>
    /// <param name="json"></param>
    /// <returns></returns>
    public static Dictionary<string, object> getValue(string json)
    {
        //解析json对象
        JavaScriptSerializer serializer = new JavaScriptSerializer();
        return (Dictionary<string, object>)serializer.DeserializeObject(json);
    }

object url;
获取json其中一个值:getValue(payJson).TryGetValue("字段名", out url).ToString()

posted @ 2017-03-30 17:46  Dukezhou  阅读(1697)  评论(0编辑  收藏  举报