Javascript module to safely encode JSON to avoid security vulnerabilities.