title: JSON to PHP Associative array
body: <p>would any of you know a good way to put this into an associative array . I have tried <a href="http://php.net/manual/en/function.json-decode.php" rel="nofollow noreferrer"><code>json_decode</code></a> but found it to not be much help.</p>
  
  <p>This is the data i need to put into an associative array:</p>
  
  <pre><code>{
    "data": [
      {
        "name": "Joe Bloggs",
        "id": "203403465"
      },
      {
        "name": "Fred Bloggs",
        "id": "254706567"
      },
      {
        "name": "Barny Rubble",
        "id": "453363843"
      },
      {
        "name": "Homer Simpson",
        "id": "263508546"
      }
    ]
  }
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>After I accepted the answer, I remembered why I thought that the json_decode wasn't working.</p>
  
  <p>Instead of having an associative array like this:</p>
  
  <pre><code>[0] =&gt; Array
  (
      [name] =&gt; Joe Bloggs
      [id] =&gt; 203403465
  )
  </code></pre>
  
  <p>I wanted one like this:</p>
  
  <pre><code>Array
  (
      [Joe Bloggs] =&gt; 45203340465
      [Fred Bloggs] =&gt; 65034033446
  )
  </code></pre>
  
  <p>Unfortunately, I had forgotten this at the time.. but I have resolved my issue now anyway. </p>
  
  <p>Thanks for all of your help!</p>