How to convert a JSON-like string to a Javascript object?
<p>I am getting a string like this:</p>

<pre><code>var json = "title: abc, link: http://google.com, size: 1";
</code></pre>

<p>How can I convert it to an Javascript object so that I can access it like <code>obj.title</code>, <code>obj.link</code> etc. This doesn’t work:</p>

<pre><code>var obj = eval("(" + json + ')');  //error
</code></pre>

<p>How to achieve this?</p>

<p>Here is the full code</p>

<pre><code>var entry = json.feed.entry[i];
//here entry = title: abc, link: http://google.com, size: 1
entry = entry.content.$t.replace(/: /g, '": "');
entry = entry.replace(/, /g, '", "');
entry = '"' + entry + '"';

var jdata = eval("(" + entry + ')'); //error: missing ) in parenthetical
</code></pre>
