Am working in MVC. In my controller am creating a list
public class GridColModelLst
{
List<GridColModel> _items = new List<GridColModel>();
public List<GridColModel> items
{
get { return _items; }
set { _items = value; }
}
}
public class GridColModel
{
public string name { get; set; }
public int? width { get; set; }
}
And passing this list as JSON which works fine and my JSON is below
[{ name: 'Humidity', width: 90}]
How do i make it like the below JSON To add a JSON Array inside a JSON object in C#
[{ name: 'Humidity', width: 90, searchoptions: { sopt: ['eq', 'ne'] } }]
Thanks
====================
update
In my controller am sending the list like
return Json(Colmodel, JsonRequestBehavior.AllowGet);
and am getting [{ name: 'Humidity', width: 90}] succesfully
What changes i need for the class to get a JSON like
[{ name: 'Humidity', width: 90, searchoptions: { sopt: ['eq', 'ne'] } }]