Commit 8cf1d163 authored by Ketan Parmar's avatar Ketan Parmar Committed by Andrew Bonventre

encoding/json: add example for json.HTMLEscape

Change-Id: Ib00fcfd46eae27eea0a3d4cab4406f4c461fb57b
Reviewed-on: https://go-review.googlesource.com/c/160517Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 15b4c71a
......@@ -301,3 +301,11 @@ func ExampleValid() {
// Output:
// true false
}
func ExampleHTMLEscape() {
var out bytes.Buffer
json.HTMLEscape(&out, []byte(`{"Name":"<b>HTML content</b>"}`))
out.WriteTo(os.Stdout)
// Output:
//{"Name":"\u003cb\u003eHTML content\u003c/b\u003e"}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment