【发布时间】:2021-05-15 18:09:04
【问题描述】:
我希望能够在 C# 中提取 json 字符串的一部分 例如,我的 json 字符串看起来像这样
{
"accountNumber": "",
"Business": "Dummy Business",
ClientId": 123,
"location": {
"Location#": 1,
"LocationID": "12345",
"Address1": "21 Fuller Road",
"Address2": "",
"City": "LOS ANGELES",
"State": "CA",
"Zipcode": "20012-1234",
"County": "123"
}
}
我希望能够通过 json xpath 提取数据,例如 location/Location#,它应该返回以下结果
"data": {
"Location#": "1"
}
同样,当我使用位置 xpath 时,它应该返回这个结果
"data": {
"location": {
"Location#": 1,
"LocationID": "12345",
"Address1": "21 Fuller Road",
"Address2": "",
"City": "LOS ANGELES",
"State": "CA",
"Zipcode": "20012-1234",
"County": "123"
}
}
【问题讨论】:
-
this 对您有帮助吗?
-
嗨@FarahJaved, 回复是否解决了问题或者这个帖子有什么更新?如果答案解决了问题,请接受 - 请参阅What should I do when someone answers my question。如果您对我的回复有任何疑问,请随时告诉我。
标签: c# asp.net json asp.net-core