pretty_print.go 251 B

12345678910111213141516
  1. package functions
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "log"
  6. )
  7. // PrettyPrint - print JSON with indentation
  8. func PrettyPrint(data any) {
  9. body, err := json.MarshalIndent(data, "", " ")
  10. if err != nil {
  11. log.Fatal(err)
  12. }
  13. fmt.Println(string(body))
  14. }