【发布时间】:2018-08-23 17:41:23
【问题描述】:
我正在努力寻找解决方案,我发现其他所有问题都非常接近但仍然不是答案。
我有一个巨大的 json,里面有很多对象和数组。 我想做的是从包含名为“time”或“time”的键的 json 中提取整个对象。我找到了相关的解决方案,但它们只是带来了关键而不是整个对象。
例 1:
{
"time": -762,
"type": "chatwheel",
"key": "156",
"slot": 1,
"player_slot": 1
}
例 2:
{
"time": 888,
"type": "building_kill",
"unit": "npc_knight",
"key": "npc_goodguys_tower1",
"slot": 7,
"player_slot": 130
},
例 3:
{
"time": 681,
"type": "obs_left_log",
"key": "[132, 124]",
"slot": 0,
"x": 132,
"y": 124,
"z": 130,
"entityleft": true,
"ehandle": 5014545,
"player_slot": 0
},
前 4:
"purchase_log": [
{
"time": -89,
"key": "orb_of_venom"
},
{
"time": -89,
"key": "tango"
},
所以,基本上,我不仅需要获取时间键,还需要获取键“时间”所属的整个对象。 (如示例) 有什么办法吗?
谢谢
【问题讨论】:
-
看看这种方法来检查洞 json stuct:stackoverflow.com/questions/10459917/… 然后你必须记住父母并检测时间键
-
请尽可能遵循minimal reproducible example 指导方针。另外,
a key named "time" or "time”之间的区别也不清楚。