]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json: document that encoding.TextMarshaler is used if no (json) Marshaler...
authorRobert Griesemer <gri@golang.org>
Mon, 28 Sep 2015 17:47:39 +0000 (10:47 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 28 Sep 2015 18:08:18 +0000 (18:08 +0000)
Change-Id: I63da54832548c325e47dc54aaa5b5112e1f3b3ba
Reviewed-on: https://go-review.googlesource.com/15048
Reviewed-by: Rob Pike <r@golang.org>
src/encoding/json/encode.go

index 90782deb70be7aedbcc837d5427a201bb7ff35da..21f403e78861200fc3455570a1640fcd18fae6fe 100644 (file)
@@ -30,7 +30,10 @@ import (
 // Marshal traverses the value v recursively.
 // If an encountered value implements the Marshaler interface
 // and is not a nil pointer, Marshal calls its MarshalJSON method
-// to produce JSON.  The nil pointer exception is not strictly necessary
+// to produce JSON. If no MarshalJSON method is present but the
+// value implements encoding.TextMarshaler instead, Marshal calls
+// its MarshalText method.
+// The nil pointer exception is not strictly necessary
 // but mimics a similar, necessary exception in the behavior of
 // UnmarshalJSON.
 //