There are many configuration formats that Go, with the use of third-party libraries, has support for. Three of the most popular data formats are TOML, YAML, and JSON. Go can support JSON out of the box, and the others have clues on how to marshal/unmarshal or encode/decode data for these formats. The formats have many benefits beyond configuration, but this chapter will largely focus on converting a Go struct in the form of a configuration struct. This recipe will explore basic input and output using these formats.
These formats also provide an interface by which Go and applications written in other languages can share the same configuration. There are also a number of tools that deal with these formats and simplify working with them.