PHP Accessing nested json elements in square brackets : <p>I am trying to access the amount property in the below json file. </p>

<pre><code>{
  "id": "evt_1EQZxID5bcg",
  "data": {
    "object": {
      "id": "cs_0G452PD7eY8ddrtuyo0KZ5sSRk",
      "display_items": [
        {
          "amount": 300,
          "currency": "gbp",
          "custom": {
            "name": "Purchase"
          },
          "type": "custom"
        }
      ],
      "livemode": false,
      "payment_method_types": [
        "card"
      ],
      "subscription": null,
      "success_url": ""
    }
  },
  "livemode": false,
  "request": {
    "idempotency_key": null
  },
  "type": "checkout.session.completed"
}
</code></pre>

<p>I have tried using this code to access the peroperty</p>

<pre><code>$object-&gt;data-&gt;object-&gt;display_items-&gt;amount
</code></pre>

<p>However, this returns no data.</p>

<p>I am thinking this has to do with the square brackets, but when I try access that alone I get an array.</p>
