prevent json_encode adding escape characters <p>Is there a solution to prevent json_encode adding escape characters? I am returning a json obj from an ajax request.</p> <p>Here is what I currently have:</p> <pre><code>foreach ($files as $file) { $inf = getimagesize( $file ); $farr[] = array ( "imgurl" =&gt; "/".str_replace( "\\" , "/" , str_replace( DOCROOT , "" , $file ) ) , "width" =&gt; $inf[0] , "height" =&gt; $inf[1] ); } $t = json_encode( $farr ); </code></pre> <p>which delivers:</p> <pre><code>[ {\"imgurl\":\"\\\/_assets\\\/portfolio\\\/96\\\/full.png\",\"width\":580,\"height\":384}, {\"imgurl\":\"\\\/_assets\\\/portfolio\\\/95\\\/full.png\",\"width\":580,\"height\":452}, {\"imgurl\":\"\\\/_assets\\\/portfolio\\\/94\\\/full.png\",\"width\":580,\"height\":384} ] </code></pre> <p>but I need:</p> <pre><code>[ {imgurl:"/_assets/portfolio/96/full.png",width:580,height:384}, {imgurl:"/_assets/portfolio/95/full.png",width:580,height:452}, {imgurl:"/_assets/portfolio/94/full.png",width:580,height:384} ] </code></pre> <p>having the imgurl width and height indexes quoted is causing the rest of my javascript to break</p> <p>not having much luck so any tips very much welcome...</p>