如题,通过webrequest,获取得到的解析代码,解析代码中有json格式的数据,得到的解析代码中有
<script language="javascript">
var info={
Type:"a",
Id:"001",
ClassId:"1",
title:"2012",
score:"118-125",
count:"10",
picList:[["http://1.jpg","","","",""],["http://2.jpg ","","","",""],["http://3.jpg ","","","",""],["http://4.jpg","","","",""]]
};
</script>
怎么把这些数据取出呢?在此拜谢了!
------解决方案--------------------------------------------------------
JQUERY吧。。。都封装好现成的了 省得你写
参考
------解决方案--------------------------------------------------------
info["Type"].....或者info[0].....
------解决方案--------------------------------------------------------
方法1,使用eval方法应该可以。
http://msdn.microsoft.com/zh-cn/library/microsoft.jscript.eval.aspx
方法2,JavaScriptSerializer
方法3,JSON.NET
http://www.soaspx.com/dotnet/csharp/csharp_20100713_5052
方法4:如果是。net4,Using C# 4.0 and dynamic to parse JSON
http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2010/08/22/using-c-4.0-and-dynamic-to-parse-json.aspx
Newtonsoft.Json.dll
http://james.newtonking.com/pages/json-net.aspx