I searched all over the web and I think I'm correctly using JSON, I just can't find what's the problem with it. I need to pass this json object as the parameter of an MVC controller action:
JSON:
{
"ContactId": "0",
"Fax2": "dsad",
"Phone2": "dsad",
"Tittle": "asdsa",
"Cellphone": "dsadsd",
"Address": { "City": "kjshksdfks",
"Country": "undefined",
"Id": "0",
"State": "dsadsa"}
}
The .NET object is as follows:
public class Contact
{
public string ContactId {get; set;}
public string Fax2 {get; set;}
public string Phone2 {get; set;}
public string Tittle {get; set;}
public string Cellphone {get; set;}
public Address ContactAddress {get; set;}
}
The nested address type is as follows:
public class Address
{
public string City {get; set;}
public string Country {get; set;}
public int Id {get; set;}
public string State {get; set;}
}
Whats wrong with my JSON?, what am i missing in order that passes clean to the controller action
The exact error is: Invalid JSON primitive: Contact
Note: I tried using a javascript object, JSON.stringify, and toJSON()
Thanks in advance!