for a legacy system, I need to return an object than have inside it a key value than it's the date, and inside have a body, any idea how to get the job done?
I need to return this array
{
"sellerId":"157747190185796800",
"data":
{
"2020-08-25":{ "sales":195000,"comission":25350},
"2020-08-26":{"sales":70500,"comission":9165},
"2020-08-27":{ "sales":51000,"comission":6630}
}
}
I'm trying with a json result and it works, but there's a problem with the key value date
Edit: I'm trying to make the suggestion of an dictionary, but, I don't know what I'm doing bad in this case. i try as an object too and doesn't work.
var lst = new List<Dictionary<string, JsonResult>>();
foreach (var item in listToReturn)
{
lst.Add(new Dictionary(item.DateFromStr, new JsonResult (new
{
sales = item.sales,
comission = item.Comission,
})));
}