Can someone explain to me how ASP.NET handles the conversion from a class object to a JSON object in WebMethods?
For example, you have the following WebMethod that returns an object Person:
[WebMethod]
public static Person GetPerson()
{
Person p = new Person()
{
Id = 1,
Name = "Test"
};
return p;
}
In my jQuery, where I call WebMethod, I get a response that contains from a json object.
How did ASP.NET do this automatically? Does he use a class JavaScriptSerializer?
You also see many examples of using JSON converters to convert a class object to a json object. Why is this? Is it because of the class JavaScriptSerializerthat it uses and its poor performance or ...?
source
share