Skip to content

Instantly share code, notes, and snippets.

@jlojosnegros
Created February 28, 2022 11:30
Show Gist options
  • Save jlojosnegros/f56eeb7339e4f73522e6d2063da276ad to your computer and use it in GitHub Desktop.
Save jlojosnegros/f56eeb7339e4f73522e6d2063da276ad to your computer and use it in GitHub Desktop.
Print K8s Object as JSON
func printJson(tag string, elem interface{}) error {
jobj, err := json.MarshalIndent(elem, "", " ")
if err != nil {
return err
}
fmt.Printf("\n%s:\n%s\n", tag, string(jobj))
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment