aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/v2_encode.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/v2_encode.go')
-rw-r--r--src/encoding/json/v2_encode.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/encoding/json/v2_encode.go b/src/encoding/json/v2_encode.go
index c8f35d4281..cbb167dbd0 100644
--- a/src/encoding/json/v2_encode.go
+++ b/src/encoding/json/v2_encode.go
@@ -68,7 +68,10 @@ import (
// slice, map, or string of length zero.
//
// As a special case, if the field tag is "-", the field is always omitted.
-// Note that a field with name "-" can still be generated using the tag "-,".
+// JSON names containing commas or quotes, or names identical to "" or "-",
+// can be specified using a single-quoted string literal, where the syntax
+// is identical to the Go grammar for a double-quoted string literal,
+// but instead uses single quotes as the delimiters.
//
// Examples of struct field tags and their meanings:
//
@@ -89,7 +92,7 @@ import (
// Field int `json:"-"`
//
// // Field appears in JSON as key "-".
-// Field int `json:"-,"`
+// Field int `json:"'-'"`
//
// The "omitzero" option specifies that the field should be omitted
// from the encoding if the field has a zero value, according to rules: