I use JsonResult in MVC. Now I am working on a web form project without any references to MVC, and I cannot find a way to return a JSON object to the client. Thank you for the help.
Asked
Active
Viewed 1,267 times
2 Answers
3
JavaScriptSerializer is a good start. And if you want more power you may checkout Json.NET. Both allow you to serialize CLR objects to JSON strings. If you are working with ASP.NET (not MVC) you could still use PageMethods or script enabled services. Also worth mentioning that WCF also supports JSON.
So, up to you to choose, play and ask if you encounter some problems implementing a specific solution.

Community
- 1
- 1

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928
2
You can use System.Runtime.Serialization.Json.DataContractJsonSerializer.
Keep in mind that the version of .NET you are targeting will determine which assembly you need to reference:
- In 3.5, add reference to System.ServiceModel.Web.dll
- In 4, add reference to System.Runtime.Serialization

jlaneaz
- 29
- 4