C# .Net 4.5 中有什么新东西可以处理更好的 JSON?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13490661/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Anything new in .Net 4.5 to process better JSON?
提问by Gero
Is there anything new about JSON handling in .NET 4.5 and VS2012 that would be better than DataContractJsonSerializer? I have seen something about System.JSON. But is it better?
.NET 4.5 和 VS2012 中的 JSON 处理有什么新东西会比 DataContractJsonSerializer 更好吗?我看过一些关于 System.JSON 的东西。但它更好吗?
I know there is JSON.NET too, but i am not sure if i am allowed to add another .dll to my project.
我知道也有 JSON.NET,但我不确定是否可以将另一个 .dll 添加到我的项目中。
采纳答案by Kapil Khandelwal
Check this link:
检查此链接:
Feature Comparison - Json.NET, DataContractJsonSerializer & JavaScriptSerializer
功能比较 - Json.NET、DataContractJsonSerializer 和 JavaScriptSerializer
It has a good feature comparision between Json.NET, DataContractJsonSerializer & JavaScriptSerializer. Just have a look at it & then decide which one to use based on your requirement.
它在Json.NET、DataContractJsonSerializer 和 JavaScriptSerializer之间有很好的功能比较。只需看看它,然后根据您的要求决定使用哪个。
Also, check this:
另外,请检查:
We (.Net Team) now use and support the popular Json.NET serializer for handling of JSON data. Json.NET is the default JSON serializer used by ASP.NET Web API and it includes support for data contracts, anonymous types, dynamic types, Dates, TimeSpans, object reference preservation, indenting, camel casing and many other useful serialization features.
我们(.Net 团队)现在使用并支持流行的 Json.NET 序列化程序来处理 JSON 数据。Json.NET 是 ASP.NET Web API 使用的默认 JSON 序列化程序,它包括对数据协定、匿名类型、动态类型、日期、时间跨度、对象引用保留、缩进、驼峰式大小写和许多其他有用的序列化功能的支持。
回答by PhonicUK
You could always use System.Web.Script.Serialization.JavascriptSerializer- I don't know why more people don't use it, it's been there a while.
你总是可以使用System.Web.Script.Serialization.JavascriptSerializer- 我不知道为什么更多的人不使用它,它已经存在一段时间了。
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx

