How to implement custom JSON serialization from ASP.NET web service?

后端 未结 5 667
灰色年华
灰色年华 2020-12-23 23:23

What options are there for serialization when returning instances of custom classes from a WebService?

We have some classes with a number of child collection class p

5条回答
  •  春和景丽
    2020-12-23 23:46

    If you're using .NET 3.x (or can), a WCF service is going to be your best bet.

    You can selectively control which properties are serialized to the client with the [DataMember] attribute. WCF also allows more fine-grained control over the JSON serialization and deserialization, if you desire it.

    This is a good example to get started: http://blogs.msdn.com/kaevans/archive/2007/09/04/using-wcf-json-linq-and-ajax-passing-complex-types-to-wcf-services-with-json-encoding.aspx

提交回复
热议问题