问题
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?
I know there is JSON.NET too, but i am not sure if i am allowed to add another .dll to my project.
回答1:
Check this link:
Feature Comparison - 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.
Also, check this:
ASP.NET MVC 4 & Json.NET :
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.
回答2:
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.
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
来源:https://stackoverflow.com/questions/13490661/anything-new-in-net-4-5-to-process-better-json