title: How to extract and access data from JSON with PHP?
body: <blockquote>
    <p>This is intended to be a general reference question and answer covering many of the never-ending <em>"How do I access data in my JSON?"</em> questions. It is here to handle the broad basics of decoding JSON in PHP and accessing the results.</p>
  </blockquote>
  
  <p>I have the JSON:</p>
  
  <pre><code>{
      "type": "donut",
      "name": "Cake",
      "toppings": [
          { "id": "5002", "type": "Glazed" },
          { "id": "5006", "type": "Chocolate with Sprinkles" },
          { "id": "5004", "type": "Maple" }
      ]
  }
  </code></pre>
  
  <p>How do I decode this in PHP and access the resulting data?</p>