Package for working with Valve Data Format writen in Go. Lexer based on Rob Pike's talk.
I found some already existed parsers written in Go, but I did not like them and I decided to write my own.
- Download and install it:
go get github.com/blukai/vdf
- Import it in your code:
import "github.com/blukai/vdf"
- Parse VDF file:
dat, err := ioutil.ReadFile("./vdfFile.txt")
if err != nil {
log.Fatal(err)
}
m := vdf.Parse(string(dat))
...and u can easily convert it's to json by adding:
jsonized, err := json.MarshalIndent(m, "", " ")
if err != nil {
log.Fatal(err)
}
err = ioutil.WriteFile("./jsonFile.json", jsonized, 0644)
if err != nil {
log.Fatal(err)
}
If you found a bug, pr's are welcome, otherwise open an issue.