我正致力于使用jira仪表板中的数据创建刻录图表。在php中使用curl,我得到了一个json对象(如下所示),我存储为$ res。这是多维的,并且作为JSON的新手,我努力将诸如changes,statisticField,startTime,endTime等属性提取到我的php代码中,即使在引用许多答案之后,我发现这太嵌套了。我可以知道如何将这些提取到php变量中吗?
我的json obj是:
{
changes: {
1435802352000: [
{
key: "PDM-6680",
column: {
notDone: true,
newStatus: "1"
}
}
],
1465224095000: [
{
key: "PDM-7104",
added: true
},
{
key: "PDM-7114",
added: true
}
],
1466160360000: [
{
key: "PDM-12865",
timeC: {
oldEstimate: 0,
newEstimate: 0,
changeDate: 1466160360000
},
column: {
notDone: false,
done: true,
newStatus: "6"
}
}
],
1466160537000: [
{
key: "PDM-12865",
timeC: {
oldEstimate: 0,
newEstimate: 0,
changeDate: 1466160537000
}
}
],
startTime: 1465387620000,
endTime: 1466185620000,
completeTime: 1466434989792,
now: 1466442135123,
statisticField: {
typeId: "field",
fieldId: "timeestimate",
id: "field_timeestimate",
name: "Remaining Time Estimate",
isValid: true,
isEnabled: true,
renderer: "duration"
},
issueToParentKeys: {
PDM-12815: null,
PDM-12417: null,
PDM-12865: "PDM-10065",
PDM-12864: "PDM-10065",
PDM-6730: null,
PDM-12861: "PDM-12420",
PDM-12420: null,
PDM-12860: "PDM-12420"
},
workRateData: {
timezone: "Asia/Singapore",
rates: [
{
start: 1466208000000,
end: 1466380800000,
rate: 0
},
{
start: 1466380800000,
end: 1466434989792,
rate: 1
}
]
},
openCloseChanges: {
1466434989881: [
{
userDisplayNameHtml: "<a class="user-hover" rel="xxxx" id="_xxxx" href="/secure/ViewProfile.jspa?name=xxxx">xxxx</a>",
operation: "CLOSE"
}
]
},
lastUserWhoClosedHtml: "<a class="user-hover" rel="xxxx" id="_xxxx" href="/secure/ViewProfile.jspa?name=xxxx">xxxxxx</a>"
}
和我的PHP代码(跳过卷曲部分)是:
<?php
$result=curl_exec($ch);
curl_close($ch);
$res= (array)json_decode($result);
$res= json_encode($res,true);
echo $res;
?>