Use `JSON.stringify` instead of manually escaping strings

* The `\b` regex was causing problems, and `JSON.stringify` handles it
  *and* the unicode characters which originally caused issues, and
  probably some other characters we don't handle also.