C# Json数据到对象

C# Json数据到对象,c#,json,C#,Json,下面是我的responseFromServer {"version":3,"status":"ok","response":{"data":[{"address":"1908 Bull Temple Road","category_ids":[29],"category_labels":[["Community and Government","Education","Colleges and Universities"]],"country":"in","email":"principal@b

下面是我的responseFromServer

{"version":3,"status":"ok","response":{"data":[{"address":"1908 Bull Temple Road","category_ids":[29],"category_labels":[["Community and Government","Education","Colleges and Universities"]],"country":"in","email":"principal@bmsce.ac.in","factual_id":"0c8c762c-52df-48d0-9add-1e6ef3f4df0d","fax":"080 2661 4357","hours":{"monday":[["7:00","15:00"]],"tuesday":[["7:00","14:00"]],"wednesday":[["7:00","13:00"]],"thursday":[["7:00","13:00"]],"friday":[["6:00","14:00"]],"saturday":[["7:00","14:00"]],"sunday":[["10:00","13:00"]]},"hours_display":"Mon 7:00-15:00; Tue 7:00-14:00; Wed-Thu 7:00-13:00; Fri 6:00-14:00; Sat 7:00-14:00; Sun 10:00-13:00","latitude":12.94172,"locality":"Bangalore","longitude":77.565889,"name":"BMS College of Engineering","postcode":"560019","region":"Karnataka","tel":"080 2662 2130","website":"http://www.bmsce.ac.in"},{"address":"R V Vidyanikethan Post, Mysore Road","category_ids":[29],"category_labels":[["Community and Government","Education","Colleges and Universities"]],"country":"in","email":"principal@rvce.ac.in","factual_id":"0389cc9b-0368-4ad7-8259-0c6021cd18d0","fax":"080 2860 0337","latitude":12.923694,"locality":"Bangalore","longitude":77.499105,"name":"R V College Of Engineering","postcode":"560059","region":"Karnataka","tel":"080 2860 1700","website":"http://www.rvce.ac.in"},"included_rows":1,"total_row_count":2}}
我是从下面的代码得到的

            WebRequest request = WebRequest.Create("RequestURL");
            // If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials;
            // Get the response.
            WebResponse response = request.GetResponse();
            // Display the status.
            Console.WriteLine(((HttpWebResponse)response).StatusDescription);
            // Get the stream containing content returned by the server.
            Stream dataStream = response.GetResponseStream();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader(dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd();
使用:


我无法反序列化响应。我想从上面的Json获取数据。任何帮助都将不胜感激。谢谢

您的json.response无法枚举。json.response中的属性数据是,您应该使用

var data = json.response.data as JArray

我无法反序列化响应
为什么?有什么问题?例外?意外的结果?您在反序列化json时遇到问题,但发布了有关如何下载json的代码。我使用了JsonConvert.DeserializeObject(responseFromServer),但无法获取“response”:{“data”:[{}]}中的数据。您能否建议一些方法来获取ResponseDynamicJSON=JsonConvert.DeserializeObject(responseFromServer)中的数据;var data=json.response;foreach(数据中的var相册){var address=album.address;}
var data = json.response.data as JArray