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

后端 未结 5 682
灰色年华
灰色年华 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:36

    Don't quote me on this working for certain, but I believe this is what you are looking for.

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public XmlDocument GetXmlDocument()
    {
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(_xmlString);
        return xmlDoc;
    }
    

提交回复
热议问题