使用C#如何提取JSON里特定节点的数据
展开全部
using System.Collections;
using System.Web.Script.Serialization;
private void button1_Click(object sender, EventArgs e)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
ArrayList arrList = jss.Deserialize<ArrayList>("[{\"aa\":2,\"bb\":1,\"cc\":1040,\"dd\":\"Y\"}]");
if (arrList.Count > 0)
{
foreach (Dictionary<string, object> arr in arrList)
{
//取到每一个aa节点的值
MessageBox.Show(arr["aa"].ToString());
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询