From 459c9a0a5af5a06593c7a19f519daf548e7e38f3 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 27 Mar 2017 16:21:28 +0100 Subject: [PATCH] Returning a blank string if there's nothing to serialize --- helper/structure/structure.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helper/structure/structure.go b/helper/structure/structure.go index 3ebfb9ace..6ad12de62 100644 --- a/helper/structure/structure.go +++ b/helper/structure/structure.go @@ -37,6 +37,11 @@ func ExpandJsonFromString(jsonString string) (map[string]interface{}, error) { } func FlattenJsonToString(input map[string]interface{}) (string, error) { + + if len(input) == 0 { + return "", nil + } + result, err := json.Marshal(input) if err != nil { return "", err