Hi SajidHussa,
Use below code.
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] { new DataColumn("Id", typeof(int)) });
dt.Rows.Add(1, "John Hammond", "United States");
dt.Rows.Add(2, "Mudassar Khan", "India");
dt.Rows.Add(3, "Suzanne Mathews", "France");
dt.Rows.Add(4, "Robert Schidner", "Russia");
var ItemList = new List<object>();
for (int i = 0; i < dt.Rows.Count; i++)
{
ItemList.Add(new { value = dt.Rows[i]["id"].ToString() });
}
var obj = new
{
error = "True",
status = "Found",
ItemList = ItemList.ToArray()
};