The reason you're being down-voted is that you've misunderstood the way types are used in JavaScript. The following code:
var x = "thing";
Creates a string, containing the characters thing
and binds the variable x
to it. There are no quotes in the string. The quotes are a message to the parser that want to store a string.
Notice that when you log this value to the console, it puts quotes round the value to show it's a string, so it appears surrounded by quotes. These quotes are not stored.
The reason your replacement code doesn't work is that there are no quotes in the string in the first place.
If you wrote the following:
var y = "\"thing\"";
or
var z = '"thing"';
then you would have a string with quotes in it.
What you should be doing is parsing the string containing true
. The quickest way is probably this:
function parseBool(input) {
if (input == "true") { return true; }
else if (input == "false") { return false; }
else return null; // or false, or throw exception, or whatever
}