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.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index 07d3098f1c..f085b5a08d 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -932,6 +932,9 @@ func (w *reflectWithString) resolve() error {
return nil
}
if tm, ok := w.v.Interface().(encoding.TextMarshaler); ok {
+ if w.v.Kind() == reflect.Ptr && w.v.IsNil() {
+ return nil
+ }
buf, err := tm.MarshalText()
w.s = string(buf)
return err