上一页 1 ··· 38 39 40 41 42
摘要: 近几日遇到一个需求.在反序列化时我并没有预先定义好的类,而是要以字典形式读取.利用Json.NetJObject下面用个实例来搞定它的读写1.Json是这样的{title:123,body:456,list:{title:'这是一个标题',body:'what'}}2.我要将其中几项都搞出来,代码:static void Main(string[] args) { string str = "{title:123,body:456,list:{title:'这是一个标题',body:'what'}}"; JOb 阅读全文
posted @ 2012-04-09 22:50 wx_xfy6369 阅读(1020) 评论(0) 推荐(0) 编辑
摘要: Json.Net如何组装jsonJSON写入StringWriter sw = new StringWriter();JsonWriter writer = new JsonWriter(sw); writer.WriteStartArray();writer.WriteValue("JSON!");writer.WriteValue(1);writer.WriteValue(true);writer.WriteStartObject();writer.WritePropertyName("property");writer.WriteValue(&qu 阅读全文
posted @ 2012-04-09 22:46 wx_xfy6369 阅读(257) 评论(0) 推荐(0) 编辑
摘要: Linq to Json基本Linq的都差不多,可以参考Json.net文档.这个并未深入研究 string str = "{title:123,body:456,list:{title:'这是一个标题',body:'what'}}"; JObject o = JObject.Parse(str); var s = from p in o.Children() select p; foreach (var item in s) { Console.WriteLine(item); } Console.ReadKey(); 阅读全文
posted @ 2012-04-09 22:44 wx_xfy6369 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-02-20 13:13 wx_xfy6369 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-06-02 15:35 wx_xfy6369 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-06-02 14:36 wx_xfy6369 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-06-02 14:21 wx_xfy6369 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-06-02 14:16 wx_xfy6369 阅读(321) 评论(0) 推荐(0) 编辑
上一页 1 ··· 38 39 40 41 42