WithIndent allows the codec to indent json output while marshalling. It is useful when the json output is meant for humans to read.
(indent string)
| 46 | // WithIndent allows the codec to indent json output while marshalling. It is |
| 47 | // useful when the json output is meant for humans to read. |
| 48 | func WithIndent(indent string) Option { |
| 49 | return func(codec *Codec) { |
| 50 | codec.indent = indent |
| 51 | codec.marshalOptions.Multiline = true |
| 52 | codec.marshalOptions.Indent = indent |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // Marshal serialize the interface{} to []byte |
| 57 | func (c Codec) Marshal(v interface{}) ([]byte, error) { |
no outgoing calls