我有一个 json 对象,它被转换为字典列表。json如下:
{
"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 格式可以根据用户输入而变化。