回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我有一组JSON数据,看起来与此类似:</p>
<pre><code>{"executions": [
{
"id": 17,
"orderId": 16,
"executionStatus": "1",
"cycleId": 5,
"projectId": 15006,
"issueId": 133038,
"issueKey": "QTCMP-8",
"label": "",
"component": "",
"projectKey": "QTCMP",
"executionDefectCount": 0,
"stepDefectCount": 0,
"totalDefectCount": 0
},
{
"id": 14,
"orderId": 14,
"executionStatus": "1",
"cycleId": 5,
"projectId": 15006,
"issueId": 133042,
"issueKey": "QTCMP-10",
"label": "",
"component": "",
"projectKey": "QTCMP",
"executionDefectCount": 0,
"stepDefectCount": 0,
"totalDefectCount": 0
}
],
"currentlySelectedExecutionId": "",
"recordsCount": 4
}
</code></pre>
<p>我已经用Python将其解析如下:</p>
<pre><code>import json
import pprint
with open('file.json') as dataFile:
data = json.load(dataFile)
</code></pre>
<p>有了它,我可以通过执行data[“executions”]等来找到执行之类的数据集。。我需要做的是在结构中搜索字符串“QTCMP-8”,然后在找到特定字符串时,找到与该字符串关联的“id”。因此,在QTCMP-8的情况下,它将是id 17;对于QTCMP-10来说是14</p>
<p>这可能吗?我需要先转换数据吗?非常感谢您的帮助</p>