From 0bb76043fd800dcbf8b4fe0643ff830e7cd8b8cc Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Sun, 11 Apr 2021 13:11:41 +0200 Subject: [PATCH] json pretty print using intent --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 ++ rest/utils.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 28db69d4032dc478ef820632b8a1493349b310c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHLJ5Iwu5S<||EFncHBSf(^U2fn+rlHLRP(FepmLmwg55*0rXgL8DM?f@4yxAEi zUSZLJ0L@6dZ+E`-v*PuHhTd_}2_@R?f>AZqd%xPd6)PZNRw1 t5D~vd77(nHj{t1sKecf*sy)aWeuZJ9C|N`w!-4)G5DD?g8TbJPJ^&MMMW_G( diff --git a/.gitignore b/.gitignore index 7240670..5bbaca5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +.DS_Store + config.json data/* diff --git a/rest/utils.go b/rest/utils.go index 2e6ff8b..46ed3e4 100644 --- a/rest/utils.go +++ b/rest/utils.go @@ -17,7 +17,7 @@ func Unauthorized(w http.ResponseWriter) { func Json(w http.ResponseWriter, data interface{}) { w.WriteHeader(200) - bytes, _ := json.Marshal(data) + bytes, _ := json.MarshalIndent(data, "", " ") w.Write(bytes) }