 <p>Since your file is not a valid JSON, you can use <code>eval</code> (it's a dirty hack but it works), example :</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>data = '{name:"sda"}'; eval('foo = ' + data); console.log(foo);</code></pre> </div> </div> </p>