MCPcopy
hub / github.com/docker/compose / ToJSON

Function ToJSON

cmd/formatter/json.go:32–39  ·  view source on GitHub ↗

ToJSON return a string with the JSON representation of the interface{}

(i any, prefix string, indentation string)

Source from the content-addressed store, hash-verified

30
31// ToJSON return a string with the JSON representation of the interface{}
32func ToJSON(i any, prefix string, indentation string) (string, error) {
33 buffer := &bytes.Buffer{}
34 encoder := json.NewEncoder(buffer)
35 encoder.SetEscapeHTML(false)
36 encoder.SetIndent(prefix, indentation)
37 err := encoder.Encode(i)
38 return buffer.String(), err
39}

Callers 3

runImagesFunction · 0.92
PrintFunction · 0.85
ToStandardJSONFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected