= pelletier go-toml = The '''`pelletier/go-toml/v2`''' package is used for (un)marshaling TOML data. <> ---- == Installation == Try `go get github.com/pelletier/go-toml/v2`. ---- == Example == {{{ package main import ( "fmt" "github.com/pelletier/go-toml/v2" ) type Animal struct { Name string Order string } func main() { file, _ := os.ReadFile("animals.toml") // Example of unmarshaling data var animals []Animal err := toml.Unmarshal(file, &animals) if err != nil { fmt.Println("error:", err) } // Example of marshaling data bytes, err := toml.Marshal(animals) if err != nil { fmt.Println("error:", err) } _ = os.WriteFile("new.toml", bytes, 0644) } }}} ---- CategoryRicottone