【发布时间】:2018-09-17 23:14:03
【问题描述】:
我是LINQ 查询的新手,想知道我想要通过LINQ 查询实现的目标是否可行。
所以,我有一个如下的 JSON 文档。
我正在尝试获取与 "$type" 匹配的所有值,并返回目录路径和 $type 的值。
我知道这样做的交互式方式,但似乎 LINQ 是首选,并且应该很容易得到它。
{
"$type":"type1",
"title":"US version",
"_object1":[
{
"$type":"type2",
"rootModule":{
"id":"page",
"modules":[
{
"id":"header",
"$type":"module-header"
},
{
"id":"footer",
"$type":"module-footer"
}
]
}
},
{
"$type":"type2",
"_id":"ab134"
},
{
"$type":"type3",
"_id":"ab567"
}
],
"_object2":[
{
"$type":"module1",
"constraintsId":"page"
},
{
"name":"header1 1",
"nestedobject":{
"$type":"nestedobject-type",
"dataBinder":{
"id":"ab244"
}
}
}
]
}
【问题讨论】:
-
I am trying to get all the values我们可以看到那部分吗? -
嗨@Plutonix,我需要JSON中所有键为“$type”的值。这解释清楚了吗?
-
你的意思是这样的? Parse json without full path.
标签: c# json linq jsonparser