在 .NET 中对 JSON 进行编码和解码时,最好使用什么?我已经尝试了这两种方法,到目前为止,JsonConvert 似乎做得很好.我过去成功使用过 JavaScriptSerializer,但最近遇到了一些问题.使用 JSON.NET 比使用 .NET 类更好吗?
What is better to use when it comes to encoding and decoding of JSON in .NET? I have tried both and upto this point JsonConvert seems to be doing a good job. I have used JavaScriptSerializer in the past successfully but have had some problems in the recent past with it. Is it better to use JSON.NET than the .NET class?
使用适当的库编码/解码 json 的首选函数是什么?我使用来自 JSON.NET 的 SerializeObject/DeSerializeObject 和来自 .NET 的 Serialize/DeSerialize.
What are the preferred functions for encoding/decoding json using the appropriate library? I use SerializeObject/DeSerializeObject from JSON.NET and Serialize/DeSerialize from .NET.
谢谢
我认为 这正是您正在寻找的比较.
I think this is exactly the kind of comparison you are looking for.
它基本上说 JSON.Net 更好,因为它除其他外......
It basically says that JSON.Net is better because it among other things...
在我看来,对于内置序列化程序来说,唯一的积极因素(而且是一个小积极因素)是不需要管理额外的外部依赖项.
In my opinion the only positive, (and it is a small positive), I can see for the built-in serializer is that there is no extra external dependency to manage.
编辑:Codeplex 有一天会关闭,因此您可以在这里 同样,在页面上搜索功能比较"即可.
Edit: Codeplex is shutting down one day so you can find the comparison here as well, just search for "Feature comparison" on the page.
这篇关于JSON.NET JsonConvert 与 .NET JavaScriptSerializer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!