开发者

Difference between JSON Serialization

What are开发者_运维问答 the pros and cons of using the following two JSON serialization methods:

  1. System.Web.Script.Serialization
  2. DataContractJsonSerializer


DataContractJsonSerializer

The primary purpose of the DataContractJsonSerializer is to be used with WCF, since one serialization is a big focus of WCF. Also, it is also better equipped to handle complex classes which have only certain properties available for serialization. This class is more strongly typed, has more knowledge about the type(s) it's handling and better error handling for badly-formed JSON.

.

JavaScriptSerializer

This class on the other hand is much better equipped for quick serialization, it's a more cowboy approach. There's less error checking and less control over what properties which are serialized.

Reference

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜