c#json到数组调试“应用程序进入中断模式”

我想将json转换为数组,但是当我尝试调试模式时,我得到“应用程序进入中断模式”,如果我尝试运行它,程序就会冻结。

我使用Convert json到C#数组的答案? 但出了点问题。

你能帮我找一下错误的原因吗?

{ public class MarketHistory { public string Date { get; set; } public string Order_Count { get; set; } public string Volume { get; set; } public string Highest { get; set; } public string Avarage { get; set; } public string Lowest { get; set; } } class Program { public static string DownloadString(string address) { WebClient client = new WebClient(); string reply = client.DownloadString(address); return reply; } static void Main(string[] args) { Console.WriteLine("Hello World!"); string url = "https://esi.tech.ccp.is/latest/markets/10000002/history/?datasource=tranquility&type_id=42"; var json = DownloadString(url); JavaScriptSerializer js = new JavaScriptSerializer(); MarketHistory[] marketHistories = js.Deserialize(json); Console.ReadKey(); } } 

}

json:

  [ { "date": "2016-11-01", "order_count": 24, "volume": 275, "highest": 28.17, "average": 28.15, "lowest": 28 }, 

第一个修复:

 { public class MarketHistory { public string date { get; set; } public string order_count { get; set; } public string volume { get; set; } public string highest { get; set; } public string avarage { get; set; } public string lowest { get; set; } } class Program { public static string DownloadString(string address) { WebClient client = new WebClient(); string reply = client.DownloadString(address); return reply; } static void Main(string[] args) { Console.WriteLine("Hello World!"); string url = "https://esi.tech.ccp.is/latest/markets/10000002/history/?datasource=tranquility&type_id=42"; var json = DownloadString(url); JavaScriptSerializer js = new JavaScriptSerializer(); MarketHistory[] marketHistories = js.Deserialize(json); Console.ReadKey(); } } 

}

我添加了参考,任何想法为什么我可以得到

未处理的exception:System.IO.FileNotFoundException:无法加载文件或程序集’System.Web.Extensions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35’。 该系统找不到指定的文件。 在Eve_console_app.Program.Main(String [] args)

错误?

使用此代码并确保引用System.Runtime.Serialization dll

 using System; using System.Collections.Generic; using System.Runtime.Serialization.Json; namespace StackOverFlow { class Program { static void Main(string[] args) { var request = System.Net.WebRequest.Create("https://esi.tech.ccp.is/latest/markets/10000002/history/?datasource=tranquility&type_id=42") as System.Net.HttpWebRequest; request.Method = "GET"; request.ContentLength = 0; using (var response = request.GetResponse() as System.Net.HttpWebResponse) { if (response.StatusCode != System.Net.HttpStatusCode.OK) { throw new Exception(response.StatusCode + "\t" + response.StatusDescription); } DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(List)); var result = jsonSerializer.ReadObject(response.GetResponseStream()) as List; } Console.ReadLine(); } } public class MarketHistory { public string date { get; set; } public string order_count { get; set; } public string volume { get; set; } public string highest { get; set; } public string average { get; set; } public string lowest { get; set; } } }