嗨,我正试图把所有东西都放在[]括号内。我已经尝试了我能找到的一切,但没有运气
{
"Items": [
{
"UID": "XXX-XXX",
"Code": "USD",
"CurrencyName": "US Dollar",
"CurrencyRate": 0.71428000,
"URI": "https://ar2.api.myob.com/accountright/XXX-XXX/GeneralLedger/Currency/XXX-XXX",
"RowVersion": "-6496407278109851648"
}
],
"NextPageLink": null,
"Count": 1
}
编辑
我的代码
$getsbCurrencyDetailsclass = new myobsbfunctions($_SESSION['access_token'],api_key);
$getsbCurrencyDetails = $getsbCurrencyDetailsclass->getResponsenew($cf_uri. "/GeneralLedger/Currency/?" .'$filter' ."=Code%20eq%20'{$docCurrencyType}'");
$getsbCurrencyDetails = json_decode($getsbCurrencyDetails);
$result=$getsbCurrencyDetails['Items'];
//print("<pre>".print_r($result,true)."</pre>");
echo $getsbCurrencyDetails
您需要将JSON转换为一个数组,然后操作这个数组。假设文本在$json
:中
$array=json_decode($json, true);
$result=$array['Items'];
编辑
我忘记了json_decode
的第二个参数