title: JSON reply with PHP in loop from MySQL
body: <p>Trying to communicate with some external API but only thing I got is example reply:</p>
  
  <pre><code> {"SUCCESS":[{"Hello msg":"Successfull list","LIST":{"Group 1":{"GROUPNAME":"Group 1","Persons":{"1":{"ID":2588,"NAME":"John Doe"}}}}}],"apiversion":"0.1"}
  </code></pre>
  
  <p>When I echo it, it's ok, but this array is little confusing for me, especially how to not get [] where I get array from mysql and get them between "SUCCESS" and "Hello msg"</p>
  
  <p>This is best what I got so far:</p>
  
  <pre><code>$someArray=array();
  $result=mysqli_query($con, "SELECT * from tbl_Persons");
  while ($row=mysqli_fetch_array($result)) {
      array_push($someArray,[
                  'ID'=&gt;$row['id'],
                  'NAME'=&gt;$row['name']
  ]);}
  
  
  $response=array();
  $response['SUCCESS']=array();
  $resposne['SUCCESS']=array('Hello msg'=&gt;'Successfull list');
  $response['SUCCESS']['List']['Group 1']=array('GROUPNAME'=&gt;'Group 1');
  $response['SUCCESS']['List']['Group 1']['Persons']=$someArray;
  echo json_encode($response);
  </code></pre>