title: To remove extra square bracket in json format
body: <p>I am trying to fetch json data from database and it shows an extra square bracket in the result. Due to this i got error in the result. How to remove this extra bracket from the JSON result.       </p>
  
  <pre><code> [[{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0},{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0}]]
  </code></pre>
  
  <p><strong>PHP code</strong></p>
  
  <pre><code>&lt;?php 
  
  
      require_once('include/dbConnect.php');
  
      $sql = "SELECT * FROM Items WHERE User_Id='1011'";
  
      $r = mysqli_query($con,$sql);
  
      //$res = mysqli_fetch_array($r);
  
      $result = array();
  
      while($res = mysqli_fetch_array($r, MYSQL_ASSOC)) {
  
          array_push($result,array(
              "Item_Name"=&gt; $res['Item_Name'],
              "Unit" =&gt; $res['Unit'],
              "Price" =&gt; $res['Price'],
              "Discount" =&gt; $res['Discount'])
          );
      }
  
      echo json_encode($result);
  
      mysqli_close($con);
  ?&gt;
  </code></pre>