title: How to add HTML code to JSON in PHP?
body: <p>I need to add folowing html code to JSON using PHP.</p>
  
  <pre><code>&lt;a class="btn btn-mini btn-success" data-toggle="modal" href="#?page=customers-database-edit&amp;id=$1"&gt;Edit&lt;/a&gt;
  </code></pre>
  
  <p>If I add this directly than that breaks the JSON code as contains double quotes (").</p>
  
  <p>So I have tried to use the following code:</p>
  
  <pre><code>if(is_string($result))
  {
    static $jsonReplaces = array(array('\\', '/', '\n', '\t', '\r', '\b', '\f', '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
    return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $result) . '"';
  }
  else
    return $result;
  </code></pre>
  
  <p>Above code generates that html is wrong way:</p>
  
  <pre><code>&lt;a class="\&amp;quot;btn" btn-mini="" btn-success\"="" data-toggle="\&amp;quot;modal\&amp;quot;" href="\&amp;quot;?page=customers-database-edit&amp;amp;id=3\&amp;quot;"&gt;Edit&amp;lt;\/a&amp;gt; \n&lt;/a&gt;
  </code></pre>