1

It just strikes me that What can JSON.net library do in special that a JavaScriptSerializer class does not?

  1. Is it worth including in a large enterprise application that talks through SOAP webservices and javascript?

  2. What performance gain/ development gain i get by including such libraries in the project?

  3. Are there similar libraries that aid in object serialization/ deserialization faster, better and smarter?

Deeptechtons
  • 10,945
  • 27
  • 96
  • 178
  • http://stackoverflow.com/questions/7685429/serializing-data-using-json-net-size-limit/7685498#7685498 – L.B Oct 10 '11 at 06:43
  • http://stackoverflow.com/questions/7647651/c-datacontractjsonserializer-fails-when-value-can-be-an-array-or-a-single-item/7648147#7648147 – L.B Oct 10 '11 at 06:44
  • http://stackoverflow.com/questions/7626717/how-to-parse-json-to-a-dynamic-object-on-windows-phone-7/7626755#7626755 – L.B Oct 10 '11 at 06:45
  • @L.B as for the size limit we keep it short and efficient so no probs, as for second link does make sense, We would not do the same for the phone. The application would be developed by different team. Thanks – Deeptechtons Oct 10 '11 at 06:52

2 Answers2

3
  1. Yes it is. Absolutely. Just because something comes by default with the .NET framework built by Microsoft it does not mean that it's the best thing to use. The size of an application, nor where it's deployed, in my view is hardly a determining factor of whether a library like JSON.net should be used. Look at your own needs and use that as the driver, not the size of your app.
  2. Substantial. JSON.net is really fast, has a lot more features and is a much "friendlier" API to use. I wouldn't hesitate recommending it for use in any application. I have personally used it in Enterprise applications, open source libraries and WP7 games.
  3. There are lots of similar libraries. JsonFx is one. Is it faster, better and smarter? Yes and no, yes and no, and yes and no respectively. There is no golden bullet for this kind of thing. You should investigate your needs and figure out which one suits you. I can almost guarantee that if you're happy to use the out-of-the-box JavascriptSerializer you won't (can't!) be disappointed with the features and speed of either of these other options.

HTH.

OJ.
  • 28,944
  • 5
  • 56
  • 71
0

I don't know too much details about the libraries. One thing I needed to do was serializing the Enums.If I use default serializer it will serialize the value of the enum ,but I wanted to get the name. So I did this using Newtonsoft.Json (JSON.net)like this,

[JsonConverter(typeof(StringEnumConverter))]
public  SearchResultType SearchResultType { get; set; }
Jayantha Lal Sirisena
  • 21,216
  • 11
  • 71
  • 92
  • not much of a buying point, because my application would have equivalent enums on client script. Which would convert back to names. Also my objects would be strongly typed strings and arrays so does not convince me. `But yes Microsoft missed Enum serialization from their list wtf` – Deeptechtons Oct 10 '11 at 06:38