我想使用谷歌圖表噸ASP.NET MVC應用程序。那裏沒有mvc例子和datatable結構。我從來沒有工作過Json,我必須創建一個json,如下面的代碼。
如何創建這樣在C#
{"cols":[
{"id":"","label":"Month","pattern":"","type":"string"},
{"id":"","label":"Sales","pattern":"","type":"number"},
{"id":"","label":"Expenses","pattern":"","type":"number"}],
"rows":[
{"c":[
{"v":"April","f":null},
{"v":1000,"f":null},
{"v":900,"f":null},
{"c":[
{"v":"July","f":null},
{"v":1030,"f":null},
{"v":null,"f":null},
"p":null
}
我找不到有關C#創建JSON容易的例子。請幫幫我。
謝謝。
不是dublicate我想動態創建此代碼。 – 2012-07-19 12:25:52
動態創建它是無關緊要的......您仍將其創建爲普通POCO,然後序列化該對象。 – 2012-07-19 12:26:42