Use JSON.generate to properly quote JS string

`JSON.dump("string")` fails as JSON can't have a string at first level (it should be an object or an array). `JSON.generate` in it's turn allows to pass [options][1], so we can enable quirks mode to use JSON as a string escaper.

Notice that although `JSON#generate` has no info about quirks mode, it uses [Generator::State][2] which has detailed info about possible options.

[1]: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/JSON.html#method-i-generate
[2]: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/JSON/Ext/Generator/State.html#method-c-new

Resolves #129