diff --git a/internal/output/render.go b/internal/output/render.go new file mode 100644 index 0000000..8465db1 --- /dev/null +++ b/internal/output/render.go @@ -0,0 +1,14 @@ +package output + +import ( + "encoding/json" +) + +// RenderAsJSON marshals and renders any data structure as pretty JSON +func RenderAsJSON(data interface{}) error { + jsonBytes, err := json.MarshalIndent(data, "", " ") + if err != nil { + return err + } + return RenderJSON(jsonBytes) +}