talira

toml (BurntSushi)

Decode and encode TOML in Go, like encoding/json

open sourceMITfree

github.com/BurntSushi/toml is the widely used Go package for reading and writing TOML files, compatible with TOML v1.1.0. It works by reflection like Go's standard encoding/json: toml.Decode fills a struct from a TOML document, an encoder writes one back, and its metadata reports keys the document had that the struct didn't. Types can decode themselves through encoding.TextUnmarshaler. It also ships tomlv, a command that validates TOML files.

Problems it solves

  • read a TOML config file into a Go struct
  • write a Go struct out as a TOML file
  • validate a TOML file from the command line

Features

  • decode TOML into Go structs with toml.Decode, by reflection
  • encode Go values as TOML
  • report keys the struct didn't decode
  • compatible with TOML v1.1.0
  • tomlv command to validate TOML files

Alternatives

The same job

These do what toml (BurntSushi) does.

  1. go-toml Read and write TOML 1.1 in Go, with an encoding/json-style API

Compare toml (BurntSushi) with the top 3