I'm trying to use automatic deserialization in my MVC action like so:
public void CreateEntitlementEntity(EntitlementEntityModel model) {
// stuff
}
And here's the class I want to deserialize:
public class EntitlementEntityModel {
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public List<string> Domains { get; set; }
public EntitlementEntityModel() { }
}
I'm passing a JSON object of data to the controller action:
data: {
FirstName: 'first',
LastName: 'last',
Email: '[email protected]',
Domains: ['a','b','c']
}
All of the properties deserialize correctly except the List of strings. I would like to turn a JSON array into a List, but it instead gives me a list with one string in it, the JSON array string.
Is there a way to accomplish this in .Net Framework 3.5?
Thanks
Maybe you can use some input from this thread?
Deserializing json array into .net class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With