From b476e722250f9a5510a1e084a8a9827228b5a55d Mon Sep 17 00:00:00 2001 From: Fabricio Date: Tue, 25 Sep 2018 20:00:02 -0300 Subject: [PATCH] change to json encode --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 76f086c..f118872 100644 --- a/main.go +++ b/main.go @@ -86,10 +86,9 @@ func getDashboardItemInfoHandler() http.Handler { idInt, _ := strconv.Atoi(idStr) for _, c := range captures { if c.ID == idInt { - json, _ := json.Marshal(c) res.Header().Add("Content-Type", "application/json") - res.Write([]byte(json)) - return + json.NewEncoder(res).Encode(c) + break } } })