Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 JSON
[{"name":"sEcho","value":3},{"name":"iColumns","value":7}]
当我使用 JOSN.NET 反序列化时,我会得到 o/p 作为名称和值的列表
name sEcho value 3
有没有可能以某种方式变得像
sEcho 3 IColumn 7
JQUERY DataTable这是从我的控制器获取的字符串,并且正在尝试使用 Newton soft 转换为一个类。
JQUERY DataTable
我如何实现这一目标?
您可以将其转换为字典
string json = @"[{""name"":""sEcho"",""value"":3},{""name"":""iColumns"",""value"":7}]"; var dict = JArray.Parse(json) .ToDictionary(x => (string)x["name"], x => (string)x["value"]); Console.WriteLine(dict["sEcho"]);