Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ASP.NET中解析JSON_C#_Asp.net_Json - Fatal编程技术网

C# 在ASP.NET中解析JSON

C# 在ASP.NET中解析JSON,c#,asp.net,json,C#,Asp.net,Json,我需要解析以下JSOn: 使用JavaScriptSerializer,如何首先遍历每个dict,然后检索每个单词的id?根据json记录匿名类型,例如: var result = new[] {new {action = "", value = false}}; // put your item structure here var list = JsonConvert.DeserializeObject(myJson, result.GetType()); foreach (dyna

我需要解析以下JSOn:


使用JavaScriptSerializer,如何首先遍历每个dict,然后检索每个单词的id?

根据json记录匿名类型,例如:

var result = new[] {new {action = "", value = false}}; // put your item structure here
var list   = JsonConvert.DeserializeObject(myJson, result.GetType());
foreach (dynamic val in  ((dynamic) list)) { ...
那你可能想通过考试。例如:

var result = new[] {new {action = "", value = false}}; // put your item structure here
var list   = JsonConvert.DeserializeObject(myJson, result.GetType());
foreach (dynamic val in  ((dynamic) list)) { ...

根据您的json设置匿名类型,例如:

var result = new[] {new {action = "", value = false}}; // put your item structure here
var list   = JsonConvert.DeserializeObject(myJson, result.GetType());
foreach (dynamic val in  ((dynamic) list)) { ...
那你可能想通过考试。例如:

var result = new[] {new {action = "", value = false}}; // put your item structure here
var list   = JsonConvert.DeserializeObject(myJson, result.GetType());
foreach (dynamic val in  ((dynamic) list)) { ...

你尝试过什么吗?有各种各样的JSon(反)序列化程序,你应该不会有任何困难找到一个…你有没有任何模型可以保存这个进行反序列化?@scheien除了制作我自己的解析器之外,我不知道从哪里开始。我知道如何在PHP中实现这一点,但我对ASPHave不太熟悉。你尝试过什么吗?那里有各种JSon(反)序列化程序,你应该很容易找到一个……你有没有任何模型可以保存它进行反序列化?@scheien除了制作自己的解析器之外,我不知道从哪里开始。我知道如何在PHP中实现这一点,但我不太熟悉如何在result中设置项结构?var result=new[]{new{dict=new KeyValuePair()};如何在result中设置项结构?var result=new[]{new{dict=new KeyValuePair()};