Created
February 7, 2023 21:21
-
-
Save corolla96/83cd1720936e55ebb3de302e644fd104 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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