SERVER-11015 Properly quote and escape javascript code in JSON output