mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 18:01:01 -06:00
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) {
|
func FlattenJsonToString(input map[string]interface{}) (string, error) {
|
||||||
|
|
||||||
|
if len(input) == 0 {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
result, err := json.Marshal(input)
|
result, err := json.Marshal(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
Loading…
Reference in New Issue
Block a user