title: create json array with php
body: <p>I find it difficult to create JSON data.
  I was wanna make out JSON like the picture below</p>
  
  <p><a href="https://i.stack.imgur.com/1tR7f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1tR7f.png" alt="enter image description here"></a></p>
  
  <p>but I'm having trouble.
  I am only able to make like the picture below</p>
  
  <p><a href="https://i.stack.imgur.com/srmlm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/srmlm.png" alt="enter image description here"></a></p>
  
  <p>The following code I created. please help me, I am really very confused</p>
  
  <pre><code>foreach ($q-&gt;result() as $row){
    $djson[] = array(
      'id' =&gt; $row-&gt;id_custome,
      'name' =&gt; $row-&gt;nama_custome
      );
  }
  return $djson;
  </code></pre>