github.com/lyft/flytestdlib@v0.3.12-0.20210213045714-8cdd111ecda1/yamlutils/yaml_json.go (about)

     1  package yamlutils
     2  
     3  import (
     4  	"io/ioutil"
     5  	"path/filepath"
     6  
     7  	"github.com/ghodss/yaml"
     8  )
     9  
    10  func ReadYamlFileAsJSON(path string) ([]byte, error) {
    11  	r, err := ioutil.ReadFile(filepath.Clean(path))
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  
    16  	return yaml.YAMLToJSON(r)
    17  }