JSON数据无法正常使用?

时间:2018-12-29 18:20:23

标签: json

我可以成功查询API并以JSON格式返回结果:

{
  "data": {
    "id": "1604eadec2006c3453fe62aafb812ece665e8adca73f5578c2c3359a51fdb019",
    "confirmations": 0,
    "amount": 2500000,
    "inputs": [
      {
        "address": "DdzFFzCqrht6Ho29XhtrC2zHKyNwND236iBAqzPq2fQTSHxLrwVwm6m6trhbtie5Efta1nEFVx1SSGggBUJHXb2Bi1QYJJ5AsFarKz6D",
        "amount": 2500000
      }
    ],
    "outputs": [
      {
        "address": "DdzFFzCqrht5X6ZxuedGgdyEXfQgMbz9B7Ed1faaEU5zZbRwwP1u1Uf9i93oE6guTaovnGE3KTvxpNqm8B28B31uRC6WXVx9aN9q9sB9",
        "amount": 2329193
      }
    ],
    "type": "local",
    "direction": "outgoing",
    "creationTime": "2018-12-29T18:05:06.415107",
    "status": {
      "tag": "applying",
      "data": {}
    }
  },
  "status": "success",
  "meta": {
    "pagination": {
      "totalPages": 1,
      "page": 1,
      "perPage": 1,
      "totalEntries": 1
    }
  }
}

当我将JSON_decode应用于$j_transfer = json_decode($transfer, true);(其中$ transfer是上面的JSON)时,我曾经能够获得$j_transfer['status']的结果以查看其是否成功,但是现在一无所获。

实际上,当我执行$j_transfer['data']['confirmations']时,我什么都不会返回,我应该得到0,但是得到空白的结果。它曾经可以正常工作,但是当他们最近进行更新时,API有所改变,现在我不明白如何获得想要的结果。

0 个答案:

没有答案