如题,例如解析数据
{"comments":[{"content":"很不错嘛","id":1,"nickname":"纳尼"},{"content":"哟西哟西","id":2,"nickname":"小强"}],"content":"你是木头人,哈哈。","infomap":{"性别":"男","职业":"程序员","博客":"http:\/\/www.cnblogs.com\/codeplus\/"},"title":"123木头人"}
{"comments":[{"content":"很不错嘛","id":1,"nickname":"纳尼"},{"content":"哟西哟西","id":2,"nickname":"小强"}],"content":"你是木头人,哈哈。","infomap":{"性别":"男","职业":"程序员","博客":"http:\/\/www.cnblogs.com\/codeplus\/"},"title":"123木头人"}
seri.Deserialize<T>(jsonString);T 是你的JSON对于的实体类
我用的4.0 怎么引用不成功啊??第一种:
using System.Web.Script.Serialization;
Script下有波浪线!
第一种:
using System.ServiceModel.Web;
using System.ServiceModel;
using System.Runtime.Serialization.Json;
Web下有波浪线!
哪位高手解释一下
???
地址是:http://codetitans.codeplex.com/
JSonReader reader = new JSonReader();
IJSonObject json = reader.ReadAsJSonObject("字符串型的Json数据");
return json["项目名称"].StringValue;//是什么类型的就获取什么属性,其他的还有Int32Value等
如果要获取嵌套的 JSonReader reader = new JSonReader();
IJSonObject json = reader.ReadAsJSonObject("字符串型的Json数据");
return json["子项目名"];//IJSonObject