title: Convert results from Sql to Json
body: <p>I have this code php</p>
  
  <pre><code>$query2 = "SELECT * FROM hosts where cod='$stream'";
      $result2=mysql_query($query2);
      while ($row2=mysql_fetch_array($result2)) 
      {
  $audio=$row2['audio'];
  $def=$row2['def'];
  $hosty=$row2['host'];   
      }
  </code></pre>
  
  <p>How I get the results to json in this format : </p>
  
  <pre><code>var sources = {"english":{"360":["bayfiles","filebox","zalaa","cramit"],"720":["cramit","180upload"]},"portugues":{"1080p":["zalaa","cramit"],"720":["cramit","180upload"]}}
  </code></pre>
  
  <p>is possible?</p>
  
  <p>Thanks</p>