RenderJSON encodes v as indented JSON. Callers should pass a slice of concrete structs (or maps) — json.Marshal handles key ordering for structs based on field declaration order, giving a stable output.
(w io.Writer, v any)
| 185 | // concrete structs (or maps) — json.Marshal handles key ordering for structs |
| 186 | // based on field declaration order, giving a stable output. |
| 187 | func RenderJSON(w io.Writer, v any) error { |
| 188 | enc := json.NewEncoder(w) |
| 189 | enc.SetIndent("", " ") |
| 190 | return enc.Encode(v) |
| 191 | } |
| 192 | |
| 193 | // RenderTSV emits a tab-separated values stream with a header row. |
| 194 | func RenderTSV(w io.Writer, headers []string, rows [][]string) error { |
no outgoing calls