title: How to add square braces around subarray data inside of a json encoded string?
body: <p>When trying to access an API the JSON array must be parsed like this</p>
  
  <pre><code>{"item":[{"id":"123456", "name":"adam"}]}
  </code></pre>
  
  <p>But when i'm doing the following code</p>
  
  <pre><code>$data = array("item" =&gt; array("id" =&gt; "123456", "name" =&gt; "adam"));
  echo json_encode($data);
  </code></pre>
  
  <p>it returns the json array without squared brackets as follows</p>
  
  <pre><code>{"item":{"id":"123456","name":"adam"}}
  </code></pre>
  
  <p>I've spent hours trying to figure out how to fix this and just can't think of a solution</p>