How do I return clean JSON from a WCF Service?

前端 未结 6 1026
借酒劲吻你
借酒劲吻你 2020-11-22 07:19

I am trying to return some JSON from a WCF service. This service simply returns some content from my database. I can get the data. However, I am concerned about the format

6条回答
  •  礼貌的吻别
    2020-11-22 08:01

    This is accomplished in web.config for your webservice. Set the bindingBehavior to and you will see the clean JSON. The extra "[d]" is set by the default behavior which you need to overwrite.

    See in addition this blogpost: http://blog.clauskonrad.net/2010/11/how-to-expose-json-endpoint-from-wcf.html

提交回复
热议问题