MCPcopy Create free account
hub / github.com/containerd/nerdctl / ToJSON

Function ToJSON

pkg/formatter/formatter.go:188–195  ·  view source on GitHub ↗

ToJSON return a string with the JSON representation of the interface{} https://github.com/docker/compose/blob/v2/cmd/formatter/json.go#L31C4-L39

(i interface{}, prefix string, indentation string)

Source from the content-addressed store, hash-verified

186// ToJSON return a string with the JSON representation of the interface{}
187// https://github.com/docker/compose/blob/v2/cmd/formatter/json.go#L31C4-L39
188func ToJSON(i interface{}, prefix string, indentation string) (string, error) {
189 buffer := &bytes.Buffer{}
190 encoder := json.NewEncoder(buffer)
191 encoder.SetEscapeHTML(false)
192 encoder.SetIndent(prefix, indentation)
193 err := encoder.Encode(i)
194 return buffer.String(), err
195}

Callers 3

inspectActionFunction · 0.92
psActionFunction · 0.92
printComposeImagesFunction · 0.92

Calls 2

EncodeMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…