如何反序列化这个Json字符串? [英] How to deserialize this Json string?
本文介绍了如何反序列化这个Json字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想反序列化字符串格式,如下所示:
I want to deserialize a string format as show below:
string s = "{\"Tbl_Name \":[[\"A01\"],[\"A02\"],[\"A03\"],[\"A04\"],[\"ALR\"],null]}";
结果应为{A01,A02,......ALR}。
希望你能提供帮助。
谢谢。
The out result should be {"A01", "A02, ... "ALR"}.
Wish you can help.
Thanks.
推荐答案
使用Json.NET您还可以将JSON对象反序列化为.NET泛型字典
Using Json.NET you can also deserialize a JSON object into a .NET generic dictionary
string s = @"{""Tbl_Name"":""[[A01],[A02],[ALR]]""}";
Dictionary<string, string> values = JsonConvert.DeserializeObject<Dictionary<string, string>>(s);
Console.WriteLine(values.Count);
Console.WriteLine(values["Tbl_Name"]);
我希望这可以帮助你入门
I hope this would help you getting started
这篇关于如何反序列化这个Json字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文