大佬教程收集整理的这篇文章主要介绍了Newtonsoft.Json序列化和反序列,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
//把Json 字符串反序列化为对象
目标对象= JavaScriptConvert.DeserializeObject(JSON字符串,typeof (目标对象));
//把目标对象序列化为Json 字符串
String
Json
字符串 = JavaScriptConvert .serializeObject(目标对象);
这里下载:http://www.newtonsoft.com/products/json/
安装:
1. 解压下载文件,得到Newtonsoft.Json.dll
2.在项目中添加引用..
序列化和反序列在.net项目中:
读取JSON
结果显示:
TokenType | ValueType | Value |
---|---|---|
StartArray | null | null |
String | System.String | JSON! |
Integer | system.int32 | 1 |
Boolean | System.Boolean | True |
StartObject | null | null |
PropertyName | System.String | property |
String | System.String | value |
EndObject | null | null |
null | null |
l
这里会打印出: ['JSON!',{property:'value'}]
.
以上是大佬教程为你收集整理的Newtonsoft.Json序列化和反序列全部内容,希望文章能够帮你解决Newtonsoft.Json序列化和反序列所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。