wince json数据格式转化
程序员文章站
2022-05-29 11:30:13
...
wince下的JSON,我在网上找了很多,但是很多和用不了,在自己坚持下,找到了一个很小的JSON的com组件(Json.dll),直接看代码
Dictionary<String, String> _Str1 = new Dictionary<string, string>();
String JsonStr = "{\"Login\":\"beatyou385981202\",\"Age\":\"24\"}";
JsonStr= JsonStr.Replace("{", "[");
JsonStr= JsonStr.Replace("}", "]");
//替换标识符——Json.Converter.Deserialize 识别的标识符是[]
_Str1 = Json.Converter.Deserialize<Dictionary<String, String>>(JsonStr);
int k = _Str1.Keys.Count;
foreach (KeyValuePair<String, String> str in _Str1)
{
MessageBox.Show(str.Key.ToString());
MessageBox.Show(str.Value.ToString());
}
最终结果显示两组弹框:
Login beatyou385981202
Age 24
这个Json 下载链接,我提供一下,免费的
http://download.csdn.net/detail/beatyou385981202/4454715
来源:http://blog.csdn.net/beatyou385981202/article/details/7788354
Dictionary<String, String> _Str1 = new Dictionary<string, string>();
String JsonStr = "{\"Login\":\"beatyou385981202\",\"Age\":\"24\"}";
JsonStr= JsonStr.Replace("{", "[");
JsonStr= JsonStr.Replace("}", "]");
//替换标识符——Json.Converter.Deserialize 识别的标识符是[]
_Str1 = Json.Converter.Deserialize<Dictionary<String, String>>(JsonStr);
int k = _Str1.Keys.Count;
foreach (KeyValuePair<String, String> str in _Str1)
{
MessageBox.Show(str.Key.ToString());
MessageBox.Show(str.Value.ToString());
}
最终结果显示两组弹框:
Login beatyou385981202
Age 24
这个Json 下载链接,我提供一下,免费的
http://download.csdn.net/detail/beatyou385981202/4454715
来源:http://blog.csdn.net/beatyou385981202/article/details/7788354