-1
我在JavaScript中有這個Json數據,我想在C#中使用完全相同的數據,我如何在C#中格式化此數據。在C中格式化Json數據#
let header = '[{"data": [{"id": "Id","name": "Full Name","age": "Age"}]}]';
這是我在MVC控制器:
public ActionResult Index()
{
User user = new User();
user.GridHeader = "[{data: [{id: Id,name: Full Name,age: Age}]}]";
user.GridData = "[{data: [{id: 1,name: Sam,age: 32}, {id: 2,name: tom,age: 22}, {id: 3,name: mina,age: 25}]}]";
return View(user);
}
我需要GridHeader相同的格式,標題
創建一個模型並綁定它...你使用什麼框架MVC,WebAPI,Winforms? –
@ johnny它使用MVC,我已經添加了更多的解釋給我的問題。 – Alma
你的「header」變量是一個字符串,而不是JSON/Javascript對象。它恰好看起來像JSON。那是你要的嗎? – ADyson