Commit cbe8a353 authored by Robert Griesemer's avatar Robert Griesemer

encoding/json: document that encoding.TextMarshaler is used if no (json) Marshaler is present

Change-Id: I63da54832548c325e47dc54aaa5b5112e1f3b3ba
Reviewed-on: https://go-review.googlesource.com/15048Reviewed-by: 's avatarRob Pike <r@golang.org>
parent 3d4cd144
......@@ -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.
//
......
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