I believe the problem is only to avoid using the tools that you use to output the string. For instance:
var msg = dojo.toJson({field1: 'string', field2: 84, field3: 'another string'}); alert(msg);
will display double quotes as uninsulated. Similarly, by running the first example, when the browser is connected to a proxy server, such as Charles, it shows double qoutes as unescaped.
So, I believe that this is just an auto-escape that Firebug / PHP does when you show the lines.
source share