From 6297a405f2887a0814b7377cc1ba5615d83f1786 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Tue, 22 Apr 2014 15:16:37 +0200 Subject: [PATCH] Do not indent API JSON responses. In one example response, this reduced the uncompressed size by 25% and the gzipped size by 11%. Change-Id: Ie80d44253124b9f8601b8ef9fc978e92dacff523 --- rules/ast/printer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/ast/printer.go b/rules/ast/printer.go index 00a406f24..cbef99958 100644 --- a/rules/ast/printer.go +++ b/rules/ast/printer.go @@ -125,7 +125,7 @@ func ErrorToJSON(err error) string { Value: err.Error(), } - errorJSON, err := json.MarshalIndent(errorStruct, "", "\t") + errorJSON, err := json.Marshal(errorStruct) if err != nil { return "" } @@ -142,7 +142,7 @@ func TypedValueToJSON(data interface{}, typeStr string) string { Type: typeStr, Value: data, } - dataJSON, err := json.MarshalIndent(dataStruct, "", "\t") + dataJSON, err := json.Marshal(dataStruct) if err != nil { return ErrorToJSON(err) }