[]裡面的JSON沒有key只有value
Infor:{"tradeCode":"5040010","mess":"成功","data":[["801","玉璜","2114-10-01","訂單","5.29","3.91","100%","100%","0.15%","0.0%","香港","香
港","1.00","1","0","0","0.00","0.0","0.0","0.0"],["802","雙龍玉璜","2114-10-01","訂單","5.17","3.82","100%","100%","0.15%","0.0%","香港","香
港","1.00","1","0","0","0.00","0.0","0.0","0.0"],["803","龍鳳玉佩","2114-10-14","訂單","2.32","1.72","100%","100%","0.3%","0.0%","香港","香
港","0.01","1","0","0","0.00","0.0","0.0","0.0"],["805","古玉屏風","2114-11-11","訂單","1.97","1.45","100%","100%","0.3%","0.0%","香港","香
港","0.01","1","0","0","0.00","0.0","0.0","0.0"],["806","古玉玉龍","2114-12-18","訂單","2.64","1.95","100%","100%","0.3%","0.0%","香港","香
港","0.01","1","0","0","0.00","0.0","0.0","0.0"]],"sid":"M74W4OIDTICHQ9AUE3NLRVGG90KUHFHT","ver":"1.0.0","zip":"n","charset":"UTF-
8","encrypt":"0","cryptKey":null,"digest":"","packetNo":1,"packetCounts":1,"returned":false}
用
List<string>
對象,下面是居於Newtonsoft.Json.Net20.dll類庫的
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
public class ClsInfor
{
public string tradeCode, mess;//其他的屬性。。自己加
public List<List<string>> data;
}
public class MyJson { public ClsInfor infor;}
string s="{ Infor: { \"tradeCode\": \"5040010\", \"mess\": \"成功\", \"data\": [[\"801\", \"玉璜\", \"2114-10-01\", \"訂單\", \"5.29\", \"3.91\", \"100%\", \"100%\", \"0.15%\", \"0.0%\", \"香港\", \"香港\", \"1.00\", \"1\", \"0\", \"0\", \"0.00\", \"0.0\", \"0.0\", \"0.0\"], [\"802\", \"雙龍玉璜\", \"2114-10-01\", \"訂單\", \"5.17\", \"3.82\", \"100%\", \"100%\", \"0.15%\", \"0.0%\", \"香港\", \"香港\", \"1.00\", \"1\", \"0\", \"0\", \"0.00\", \"0.0\", \"0.0\", \"0.0\"], [\"803\", \"龍鳳玉佩\", \"2114-10-14\", \"訂單\", \"2.32\", \"1.72\", \"100%\", \"100%\", \"0.3%\", \"0.0%\", \"香港\", \"香港\", \"0.01\", \"1\", \"0\", \"0\", \"0.00\", \"0.0\", \"0.0\", \"0.0\"], [\"805\", \"古玉屏風\", \"2114-11-11\", \"訂單\", \"1.97\", \"1.45\", \"100%\", \"100%\", \"0.3%\", \"0.0%\", \"香港\", \"香港\", \"0.01\", \"1\", \"0\", \"0\", \"0.00\", \"0.0\", \"0.0\", \"0.0\"], [\"806\", \"古玉玉龍\", \"2114-12-18\", \"訂單\", \"2.64\", \"1.95\", \"100%\", \"100%\", \"0.3%\", \"0.0%\", \"香港\", \"香港\", \"0.01\", \"1\", \"0\", \"0\", \"0.00\", \"0.0\", \"0.0\", \"0.0\"]], \"sid\": \"M74W4OIDTICHQ9AUE3NLRVGG90KUHFHT\", \"ver\": \"1.0.0\", \"zip\": \"n\", \"charset\": \"UTF-8\", \"encrypt\": \"0\", \"cryptKey\": null, \"digest\": \"\", \"packetNo\": 1, \"packetCounts\": 1, \"returned\": false} }";
MyJson o = JsonConvert.DeserializeObject(s,typeof(MyJson)) as MyJson;
Response.Write(o == null);
ClsInfor infor = o.infor;
Response.Write(infor.mess + "<BR>");
foreach (List<string> list in infor.data)
{
Response.Write(string.Join(",", list.ToArray()) + "<br>");
}