Skip to content

Instantly share code, notes, and snippets.

@corolla96
Created February 7, 2023 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corolla96/83cd1720936e55ebb3de302e644fd104 to your computer and use it in GitHub Desktop.
Save corolla96/83cd1720936e55ebb3de302e644fd104 to your computer and use it in GitHub Desktop.
func PrettyString(str string) (string, error) {
var prettyJSON bytes.Buffer
if err := json.Indent(&prettyJSON, []byte(str), "", " "); err != nil {
return "", err
}
return prettyJSON.String(), nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment