Returning a blank string if there's nothing to serialize
This commit is contained in:
parent
277d1b6b2d
commit
459c9a0a5a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue