【发布时间】:2017-07-17 16:25:50
【问题描述】:
我有一个类似这样的 JSON:
{
"key": "Target",
"value": {
"__type": "Entity:http://schemas.microsoft.com/xrm/2011/Contracts",
"Attributes": [
{
"key": "prioritycode",
"value": {
"__type": "OptionSetValue:http://schemas.microsoft.com/xrm/2011/Contracts",
"Value": 1
}
},
{
"key": "completeinternalreview",
"value": false
},
{
"key": "stepname",
"value": "10-Lead"
},
{
"key": "createdby",
"value": {
"__type": "EntityReference:http://schemas.microsoft.com/xrm/2011/Contracts",
"Id": "ca2ead0c-8786-e511-80f9-3863bb347b18",
"KeyAttributes": [],
"LogicalName": "systemuser",
"Name": null,
"RowVersion": null
}
}
]
}
}
如何通过搜索key的值来获取key/value?
例如我想得到键值对'completeinternalreview'
【问题讨论】:
-
反序列化 JSON 字符串后,您将拥有一个带有
value.Attributes的对象,您可以在该对象上执行简单的 LINQ 查询。
标签: json.net