title: Uncaught SyntaxError: Unexpected token ' in JSON at position 2
body: <p>I've an encoded stringifyed JSON object stored in database, I decoded it and loaded it and tried to parse it into an object But I get</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token ' in JSON at position 2
        at JSON.parse ()</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>var attr = new Object();
  attr = JSON.parse(code[1].replace(/"/g, "'"));
  </code></pre>
  
  <p>Object decoded:</p>
  
  <blockquote>
    <p>[{'inputs':0,'type':'variable'},{'inputD':0,'type':'variable'},{'inputI':0,'type':'variable'},{'paras':0,'type':'variable'},{'headers':0,'type':'variable'},{'menus':0,'type':'variable'},{'lists':0,'type':'variable'},{'divs':0,'type':'variable'},{'links':0,'type':'variable'},{'images':0,'type':'variable'},{'elemName':'{}','type':'object'},{'borders':[],'type':'array'},{'nested':[],'type':'array'},{'ribbons':[],'type':'array'},{'tooltips':[],'type':'array'},{'gradColors':'{}','type':'object'},{'events':'{}','type':'object'},{'sTarget':'{}','type':'object'},{'sMain':'{}','type':'object'},{'orignalStyle':'{}','type':'object'},{'objNewStyle':'{}','type':'object'},{'functions':'{}','type':'object'},{'reverse':'{}','type':'object'},{'reverseFunction':'{}','type':'object'},{'scDetails':'{}','type':'object'}]</p>
  </blockquote>