摘要: 转自:http://james.newtonking.com/jsonSerialize JSONProductproduct=newProduct();product.Name="Apple";product.Expiry=newDateTime(2008,12,28);product.Sizes=newstring[]{"Small"};stringjson=JsonConvert.SerializeObject(product);//{//"Name":"Apple",//"Expiry" 阅读全文
posted @ 2014-02-08 15:39 息晴海 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 1.parse 用于从一个字符串中解析出json 对象。例如var str='{"name":"cpf","age":"23"}'经 JSON.parse(str) 得到:Object: age:"23" name:"cpf" _proto_:Objectps:单引号写在{}外,每个属性都必须双引号,否则会抛出异常2.stringify用于从一个对象解析出字符串,例如var a={a:1,b:2}经 JSON.stringify(a)得到:“{“a”:1,&q 阅读全文
posted @ 2014-02-08 14:54 息晴海 阅读(83664) 评论(2) 推荐(6) 编辑