FormatJSON formats the input json bytes with indentation. If Indent fails, it returns the unchanged input as string.
(b []byte)
| 64 | // |
| 65 | // If Indent fails, it returns the unchanged input as string. |
| 66 | func 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 | } |
no test coverage detected