Reputation: 61
I am trying to POST an object via jQuery AJAX call to .NET controller.
The object I am posting (ACDto) has among its properties a nested array (Keys) of objects
All is well but the nested array has its objects not bound/de-serialized correctly: all properties of the objects from the nested array are wither null, 0 or false. Example:
View:
Controller:
I do console.log()
the data before Ajax post and looks good (valid jSON)
What am I missing ? I will appreciate your help!
Upvotes: 0
Views: 218
Reputation: 50728
Try using public properties instead of fields:
public class AcBitDto
{
public string tag { get; set; }
public string name { get; set; }
public boolon { get; set; }
public bool enabled { get; set; }
}
Fields will not work: Binding public fields with ASP.NET MVC as well as public properties?
Upvotes: 1