title: json_decode returns JSON_ERROR_SYNTAX in OpenCart
body: <p>I am working on the admin interface of an OpenCart shipping extention.</p>
  
  <p>I have a form that has a hidden field, this field is populated by <code>JSON.stringify(rules)</code> on the front end</p>
  
  <p>The variable <code>rules</code> is a multi-tiered object.</p>
  
  <p>In the controller I can read the <code>$this-&gt;request-&gt;post['rules']</code> variable and the looks to be valid JSON, but <code>json_last_error()</code> gives me <code>JSON_ERROR_SYNTAX</code></p>
  
  <p>I check that my JSON is UTF-8 with <code>mb_detect_encoding()</code> (returns <code>ASCII</code>)
  and I have 
  removed invalid charicters with the following code</p>
  
  <pre><code>for ($i = 0; $i &lt;= 31; ++$i) { 
      $rules = str_replace(chr($i), "", $rules); 
  }
  $rules = str_replace(chr(127), "", $rules);
  
  if (0 === strpos(bin2hex($rules), 'efbbbf')) {
      $rules = substr($rules, 3);
   }
  </code></pre>
  
  <p>an example of my generated JSON"</p>
  
  <pre><code>{"SMEVT":{"id":"SMEVT","name":"Free","high":99999,"low":575,"amount":0,"type":1},"VZWSR":{"id":"VZWSR","name":"25%","high":575,"low":0,"amount":25,"type":1}}
  </code></pre>
  
  <p>I cant figure out what <code>json_decode</code> will not work. Thanks for any help.</p>
  
  <p>UPDATE:</p>
  
  <p>I used <code>strlen($rules)</code> and discovered the string was much longer that expected, seems OpenCart(or somthingelse) is adding <code>&amp;quot;</code> in place of the <code>"</code> in the JSON string.</p>
  
  <p>Anyone know of an easy way to clean this up?</p>