aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/encode.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/encode.go')
-rw-r--r--src/encoding/json/encode.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index e5dd1b7799..b4fba476c8 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -600,7 +600,13 @@ func stringEncoder(e *encodeState, v reflect.Value, opts encOpts) {
if !isValidNumber(numStr) {
e.error(fmt.Errorf("json: invalid number literal %q", numStr))
}
+ if opts.quoted {
+ e.WriteByte('"')
+ }
e.WriteString(numStr)
+ if opts.quoted {
+ e.WriteByte('"')
+ }
return
}
if opts.quoted {