MCPcopy Create free account
hub / github.com/DoNewsCode/core / WithIndent

Function WithIndent

codec/json/json.go:48–54  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
48func 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
57func (c Codec) Marshal(v interface{}) ([]byte, error) {

Callers 2

getHandlerFunction · 0.92
TestJSON_MarshalFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestJSON_MarshalFunction · 0.68