github.com/mingfang/terraform@v0.11.12-beta1/helper/structure/flatten_json.go (about)

     1  package structure
     2  
     3  import "encoding/json"
     4  
     5  func FlattenJsonToString(input map[string]interface{}) (string, error) {
     6  	if len(input) == 0 {
     7  		return "", nil
     8  	}
     9  
    10  	result, err := json.Marshal(input)
    11  	if err != nil {
    12  		return "", err
    13  	}
    14  
    15  	return string(result), nil
    16  }