Returning a blank string if there's nothing to serialize

This commit is contained in:
tombuildsstuff 2017-03-27 16:21:28 +01:00
parent 277d1b6b2d
commit 459c9a0a5a
1 changed files with 5 additions and 0 deletions

View File

@ -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