これを行うより良い方法はありますか?
JavaScriptSerializer jss = new JavaScriptSerializer();
Dictionary<string, object> dic =
jss.Deserialize<Dictionary<string, object>>(json);
Dictionary<string, object>.Enumerator enumerator = dic.GetEnumerator();
enumerator.MoveNext();
ArrayList arr = (ArrayList)enumerator.Current.Value;
foreach (Dictionary<string, object> item in arr)
{
string compID = item["compID"].ToString();
string compType = item["compType"].ToString();
}
私が欲しいのは、アイテムの配列(つまり、コンプ)だけです
次のようなjsonを送信しています:
{ "comps" : [ { compID : 1 , compType : "t" } , { ect. } ] }