YAML
Content-Type: "application/x-yaml"
YAML (a recursive acronym for "YAML Ain't Markup Language") is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax which intentionally differs from SGML.
The Context.YAML(v)
is the method which sends YAML responses to the client. It accepts a value of any type. You only need the yaml
struct field and all fields should be exported.
Result
The same result can be achieved using iris.Map
or a standard Go map
:
References:
Last updated