title: Output of decodeURIComponent cannot be parsed by JSON.parse()?
body: <p>Why doesn't the following work?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;script&gt;
  
  var str="{&amp;quot;bmi&amp;quot;:&amp;quot;25.25&amp;quot;}";
  
  var unesc = decodeURIComponent(str);
  document.write(unesc);
  
  var obj = JSON.parse(unesc);
  document.write(JSON.stringify(obj));
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="https://jsfiddle.net/p4c4q6q1/1/" rel="nofollow">https://jsfiddle.net/p4c4q6q1/1/</a></p>
  
  <p>Looks like JSON.parse() is not liking the output of decodeURIComponent() for some reason. If I manually replace the string reference with the actual string then JSON.parse() works.</p>