Decoding into Go values
Everything on these pages is reachable from
codec. The root
package re-exports Marshal, Unmarshal, ToJSON and FromJSON; anything
with options lives in codec.
- The three entry points, the two constructors, and the interfaces a type can implement to control its own encoding.
- What
yaml:"..."means, whatjson:"..."means, and the two options that decide whether the second one is read at all. - The nineteen
DecodeOptions, grouped by what they change, and the four that do nothing on their own. - The seventeen
EncodeOptions: layout, quoting, what is left out, anchors and comments. - Declaring an anchor, referring to it, merging one mapping into another — and the two places where the default does not do what the document says.
- Reading a document’s comments and writing them back, through a map keyed by path.
- What the library returns when a document is wrong, and how to print it with the offending line underneath.
- What
%YAML 1.1changes, what a!!tag does, and the one rule that keeps them apart.