ASP.NET will handle JSON deserializing a page method's parameters automatically.
For example, if you have this Person
class:
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
}
And a page method that accepts a parameter of that type:
[WebMethod]
public static void DoSomethingWithPerson(Person ThePerson)
If you pass JSON like this into the method:
{"ThePerson":{"FirstName":"Dave","LastName":"Ward"}}
Then, the ASP.NET will automatically convert the JSON to an instance of the Person
class and send that into the page method as ThePerson
.