netmaker/cli/functions/pretty_print.go
2022-12-08 18:07:45 +05:30

16 lines
251 B
Go

package functions
import (
"encoding/json"
"fmt"
"log"
)
// PrettyPrint - print JSON with indentation
func PrettyPrint(data any) {
body, err := json.MarshalIndent(data, "", " ")
if err != nil {
log.Fatal(err)
}
fmt.Println(string(body))
}