日期:2014-05-18  浏览次数:21339 次

JSON数据读取问题
我从一个地方读取到以下JSON格式的数据,请问在c# winfrom中如何把想要的值读取出来,比如我想取到oid的值等于6
[{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":6,"businessname":"手机彩信报纸","businesscode":"sjcxbz","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]},{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":7,"businessname":"12530","businesscode":"12530","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]},{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":8,"businessname":"爱婴宝典","businesscode":"aybd","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]},{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":21,"businessname":"飞信","businesscode":"fx","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]},{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":22,"businessname":"一起玩吧","businesscode":"yqwb","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]},{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":23,"businessname":"动感地带","businesscode":"dgdd","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]},{"usermobileaccessinfos":[],"lastmodifydate":null,"operatorinfoByOperatorinfooid":null,"businessdemoinfo":null,"oid":41,"businessname":"test","businesscode":"test","businessdemoinfos":[],"createdate":null,"operatorinfoByLastmodifyoperatorinfooid":null,"businesssenderinfos":[]}]

------解决方案--------------------
www.json.org 下载一个json.net

------解决方案--------------------
可以将json反序列化后读取.
参看
http://msdn.microsoft.com/zh-cn/library/system.runtime.serialization.json.datacontractjsonserializer.aspx
http://blog.csdn.net/lee576/archive/2008/03/31/2234242.aspx

如果你要不嫌麻烦也可以分析字符串直接取出来.


------解决方案--------------------
我也不知道json是什么。