MCPcopy Create free account
hub / github.com/edoardottt/pphack / FormatJSON

Function FormatJSON

pkg/output/json.go:39–51  ·  view source on GitHub ↗

FormatJSON returns the input as JSON string.

(input *ResultData)

Source from the content-addressed store, hash-verified

37
38// FormatJSON returns the input as JSON string.
39func FormatJSON(input *ResultData) ([]byte, error) {
40 var jsonOutput bytes.Buffer
41
42 enc := json.NewEncoder(&jsonOutput)
43 enc.SetEscapeHTML(false)
44
45 err := enc.Encode(input)
46 if err != nil {
47 return nil, err
48 }
49
50 return jsonOutput.Bytes(), nil
51}

Callers 3

TestFormatJSONFunction · 0.92
writeFunction · 0.92
JSONOutputFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatJSONFunction · 0.74