I have been playing around with JSON a little, but I found something I don't quite understand, for example, I have this piece of code:
var str = "{'name':'vvv'}";
var cjson = eval ("(" + str + ")");
alert(cjson.name);
It works fine, but with this piece of code
var str = "{'name':"+'vvv'+"}";
var cjson = eval ("(" + str + ")");
alert(cjson.name);
It does not, I got the following firebug error : ReferenceError: vvv is not defined.
Why doesnt it works with the second way, isnt str a valid string in both cases?