{
  "id": "cc0f9451f104f7081ab29476",
  "source": "go:encoding/json",
  "type": "go-function",
  "title": "json.func HTMLEscape",
  "content": "# json.func HTMLEscape ¶\n\n```\nfunc HTMLEscape(dst *bytes.Buffer, src []byte)\n```\n\nHTMLEscape appends to dst the JSON-encoded src with \u003c, \u003e, \u0026, U+2028 and U+2029\ncharacters inside string literals changed to \\u003c, \\u003e, \\u0026, \\u2028, \\u2029\nso that the JSON will be safe to embed inside HTML \u003cscript\u003e tags.\nFor historical reasons, web browsers don't honor standard HTML\nescaping within \u003cscript\u003e tags, so an alternative JSON encoding must be used.",
  "url": "https://pkg.go.dev/encoding/json#func HTMLEscape ¶",
  "metadata": {
    "examples": "null",
    "import_path": "Standard library/encoding/json",
    "kind": "function",
    "package": "json",
    "signature": "func HTMLEscape(dst *bytes.Buffer, src []byte)",
    "symbol": "func HTMLEscape ¶"
  },
  "hash": "d7c33b74f67f6624fe40b7747d6512fd21a949194d1b783f4df70d06323a104a",
  "timestamp": "2026-02-23T11:22:10.080599018+01:00"
}