C#解析Json

public class TransportUtility
    {
        public static OuterClass GetTransportWeb(string actionName, string json)
        {
            var serverUrl = "http://42.121.253.250:800/api/yanwen";
            var client = new WebClient { Encoding = Encoding.UTF8 };
            client.Headers.Add("Content-Type", "Application/json; charset=utf-8");
            client.Headers.Add("Provider-Name", "winit");
            client.Headers.Add("Action-Name", actionName);

            var jsonData = client.UploadString(serverUrl, json);
            var ser = new JavaScriptSerializer();
            return ser.Deserialize<OuterClass>(jsonData); 
        }
    }


    public class OuterClass
    {
        public bool HasError;
        public string ErrorMessage; 
        public string Data;
    }

 

posted @ 2015-06-16 14:19  奇风★逍遥  阅读(135)  评论(0编辑  收藏  举报