Skip to content

Commit 35cff57

Browse files
authored
Add files via upload
1 parent f1fd7d6 commit 35cff57

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

main/jsonPretty.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"bytes"
5+
"encoding/json"
6+
)
7+
8+
//Function to manually indent the JSON data for easy human readablity
9+
func PrettyString(str string) (string, error) {
10+
var prettyJSON bytes.Buffer
11+
if err := json.Indent(&prettyJSON, []byte(str), "", " "); err != nil {
12+
return "", err
13+
}
14+
return prettyJSON.String(), nil
15+
}

0 commit comments

Comments
 (0)