https://blog.miniasp.com/post/2008/08/05/How-to-read-Excel-file-using-OleDb-correctly.aspx
https://blog.miniasp.com/post/2008/08/05/How-to-read-Excel-file-using-OleDb-correctly.aspx
https://dotblogs.com.tw/shadow/2012/08/16/74099
這招在Json.net的官方文件有範例(用JObject.FromObject的那個):http://james.newtonking.com/projects/json/help/html/CreatingLINQtoJSON.htm
https://docs.microsoft.com/zh-tw/sql/relational-databases/json/json-data-sql-server?view=sql-server-2017
=Json=
Tokens f = new Tokens("This is a sample sentence.", newchar[] {' ','-'}); // Display the tokens.
[HttpPost]
public JsonResult GetProductsJSONResult()
{
ProductService service = new ProductService();
var data = service.FetchAll();
List<Dictionary<string, object>> ja = new List<Dictionary<string, object>>();
foreach (var item in data)
{
Dictionary<string, object> jo = new Dictionary<string, object>();
jo.Add("ProductID", item.ProductID);
jo.Add("ProductName", item.ProductName);
jo.Add("CategoryID", item.CategoryID);
jo.Add("CategoryName", item.Category.CategoryName);
jo.Add("SupplierID", item.SupplierID);
jo.Add("CompanyName", item.Supplier.CompanyName);
ja.Add(jo);
}
return Json(ja);
}