Created
May 2, 2020 11:02
-
-
Save makotom/8de8ba91cdea3c6ec71af39c6dff67bb to your computer and use it in GitHub Desktop.
Convert config.yml into JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
yaml "github.com/notnoopci/yaml" | |
) | |
func main () { | |
var result map[string]interface{} | |
config, _ := ioutil.ReadFile("config.yml") | |
yaml.Unmarshal(config, &result) | |
jsonStr, _ := json.Marshal(result) | |
fmt.Printf("%v\n", string(jsonStr)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment