MCPcopy
hub / github.com/grpc/grpc-go / FormatJSON

Function FormatJSON

internal/pretty/pretty.go:66–73  ·  view source on GitHub ↗

FormatJSON formats the input json bytes with indentation. If Indent fails, it returns the unchanged input as string.

(b []byte)

Source from the content-addressed store, hash-verified

64//
65// If Indent fails, it returns the unchanged input as string.
66func FormatJSON(b []byte) string {
67 var out bytes.Buffer
68 err := json.Indent(&out, b, "", jsonIndent)
69 if err != nil {
70 return string(b)
71 }
72 return out.String()
73}

Calls 1

StringMethod · 0.95

Tested by

no test coverage detected