What ways are there for the controller to return json with empty property model or list, but not null
Example model:
public class Model
{
public string name;
public string comment;
public List<Contact> Contacts;
}
public class Contact
{
public int id;
public string title;
}
static void Main(string[] args)
{
Model model1 = new Model()
{
name = "Max"
};
}
and if we have an empty list, then I want to get such a json:
{
"name": "Max",
"comment": "",
"contacts": []
}