title: PHP json_encode Problem with Backslash and Array Name
body: <p>I'm converting some postgresql data to PHP json_encode, but I have some problems: </p>
  
  <ul>
  <li><p>json_encode adds an BackSlash to all slashes that I have in my data.</p></li>
  <li><p>In descriptions apears the close of paragraph tag , i think because the backslashes problem...</p></li>
  <li><p>and i don't want my array inside the object named with index "0" but with the name "attach:"</p></li>
  </ul>
  
  <p><strong>MY JSON OUTPUT:</strong></p>
  
  <pre><code>{"arns":[{"arn":"CSC-ECN-NAUB109","problem":"description problem&lt;\/p&gt;",
  "solution":"solution description&lt;\/p&gt;",
     "0":[{"name":"jquery.png","path":"http:\/\/arn.test.pt\/uploads\/CSC-ECN-NAUB109\/jquery.png"}]}]} 
  </code></pre>
  
  <p><strong>MY CODE:</strong></p>
  
  <pre><code>&lt;?php 
  
  require('includes/connection.php');
  
  $modelos_info = (isset($_GET['models'])) ? $_GET['models'] : "none";
  
  if($modelos_info != "none"){
  
  $sth = $dbh-&gt;query("SELECT * FROM arn_info JOIN upload2 ON (arn_info.arn=upload2.id_arn) WHERE modelos LIKE '$modelos_info ;%' OR modelos LIKE '%; $modelos_info ;%' ");
  
  $sth-&gt;setFetchMode(PDO::FETCH_ASSOC);
  
  $response = array();
  $posts = array();
  
  while($row = $sth-&gt;fetch())
  { 
  
  $arn=$row ['arn'];
  $problem=$row['problem'];
  $solution=$row['solution'];
  $name=$row['name'];
  $path=$row['path'];
  
  $posts_anexos['attach'] = $posts2;
  
  $posts2[] = array('name'=&gt; $name , 'path'=&gt; 'http://arn.test.pt/' .$path);
  $posts[] = array('arn'=&gt; $arn , 'problem'=&gt; $problem , 'solution'=&gt; $solution, $posts2 );
  } 
  
  $response['arns'] = $posts;
  
  $fp = fopen('arns.json', 'w');
  
  fwrite($fp, json_encode($response));
  
  fclose($fp);
  
  echo json_encode($response);
  
  }
  ?&gt;
  </code></pre>
  
  <p>Thanks</p>