Skip to content

Tag: yaml

Parsing YAML in GO

Go supports JSON via its standard libraries. However, it does not support YAML – which is interesting when you think about it. YAML is after all just JSON written in a specific way. It is useful to have a high-level understanding of how GO supports JSON before diving into YAML. The first thing you need to do is model your data as a struct: View the code on Gist. Notice how there is a string with some metadata for each field. This tells Go what each field is named in your JSON. After this, you can include the encoding/JSON library you get a…