I have the following arbitrary JSON object(The field names may be changed).
{
firstname: \"Ted\",
lastname: \"Smith\",
age: 34,
married : t
Have a ViewModel with the same signature and use that as the argument type.Model binding will work then
public class Customer
{
public string firstname { set;get;}
public string lastname { set;get;}
public int age{ set;get;}
public string location{ set;get;}
//other relevant proeprties also
}
And your Action method will look like
public JsonResult GetData(Customer customer)
{
//check customer object properties now.
}