ASP.NET WebService is Wrapping my JSON response with XML tags

前端 未结 6 1105
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 11:49

I\'m not sure where I\'m going wrong of what I\'m missing.

I\'m building an ASP.NET 2.0 (on the .Net 3.5 framework) Web application and I am including a webservice.

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 12:02

    In your code, don't "return" the json. Use instead:

    Context.Response.Write(ser.Serialize(jsonData));

    Then you'll be good.

    The regular return command helps you by putting in a more proper service format. Some would say it'd be better form to use this, and unwrap your json on the client from this format. I say, just spit down the stuff exactly how you want to use it!

提交回复
热议问题