我有一个json对象,它已被转换为字典列表。将JSON如下:如何遍历C#中的通用字典列表#
{
"DataList":
{"Non Fuel":
{
"sn":"/DataXmlProduct/Customers/DataXml/Customer/DueDate",
"ItemCode":"/DataXmlProduct/Customers/DataXml/Customer/InvoiceNo",
"Qty":"/DataXmlProduct/Customers/DataXml/Customer/CustomerNo",
"Amount":"DataXml/Customer/TotalCurrentCharges"
},
"Fuel":{
"sn":"/DataXmlProduct/Customers/DataXml/Customer/InvoiceNo",
"ItemCode":"/DataXmlProduct/Customers/DataXml/Customer/InvoiceNo",
"Amount":"DataXml/Customer/TotalCurrentCharges"
}
}
}
结果是(Dictionary<string, object>
),每个字典这里的价值又是一本字典,我需要通过字典的每个值动态迭代,并获得最后的关键&值,其中该值是一个Xpath,需要从xpath获取值。 请帮助我解决方案来遍历字典。它应该是通用的,因为json格式可以根据用户输入而变化。