I have an end-point in ASP.NET WEB API application which looks like this:
[HttpPost]
public dynamic Save(string userId, List<MyObject> data)
{
return null;
}
public class MyObject
{
public string name { get; set; }
public List<itemAttribute> items { get; set; }
}
public class itemAttribute
{
public int id { get; set; }
public string typeName { get; set; }
public string fullName { get; set; }
public bool Checked { get; set; }
}
I am trying to post following JavaScript object
data = [
{
"name": "One",
"items": [
{
"fullName": "name",
"Checked": true,
"typeName": "type 1",
"id": 1
},
{
"fullName": "nametwo",
"Checked": true,
"typeName": "some type 2",
"id": 2
}
]
}
]
When the I hit the endpoint, data
is coming as an empty list. I don't see any specific error. Please help.
Right now I am posting data using REST Client of fire fox