0xDECAFBAD 0xDECAFBAD - 1 month ago 14
C# Question

Is the JavaScriptSerializer class deprecated?

The MSDN documentation of the JavaScriptSerializer-class states:


Json.NET should be used serialization and deserialization. Provides serialization and deserialization functionality for AJAX-enabled applications.


Should this be some sort of deprecation hint or should this class not be used in general at all (for the purpose of JSON serialization)?

Answer

Is it deprecated

No or else they would of marked it as Obsolete

should this class not be used in general

I can't see any reason not to use it if you want to. So feel free to use it, but read the below first:


Now is it the best serialiser to use? Basically no and even Microsoft know this and use Json.Net internally for things such as the Web.API. Hence the recommendation. It has several advantages over the JavaScriptSerializer. It seems the new Microsoft is attempting to embrace the open source community (hopefully not to extinguish it...) and utilise the wealth of tools out there.

It seems Microsoft can't make up their minds about making it actually obsolete. My guess is they still maintain it because it's used internally and re-writing stuff to use Json.Net is just more work than it's worth.

Tl;Dr

Use Json.Net

Comments