How to create JSON string in C#

后端 未结 14 1022
闹比i
闹比i 2020-11-22 12:39

I just used the XmlWriter to create some XML to send back in an HTTP response. How would you create a JSON string. I assume you would just use a stringbuilder to build the

14条回答
  •  长情又很酷
    2020-11-22 13:26

    If you're trying to create a web service to serve data over JSON to a web page, consider using the ASP.NET Ajax toolkit:

    http://www.asp.net/learn/ajax/tutorial-05-cs.aspx

    It will automatically convert your objects served over a webservice to json, and create the proxy class that you can use to connect to it.

提交回复
热议问题