Documentation ¶
Index ¶
- func FromJSON(str string) map[string]interface{}
- func FromJSONArray(str string) []interface{}
- func FromYAML(str string) map[string]interface{}
- func FromYAMLArray(str string) []interface{}
- func FuncMap() template.FuncMap
- func ToJSON(v interface{}) string
- func ToTOML(v interface{}) string
- func ToYAML(v interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromJSON ¶
fromJSON converts a JSON document into a map[string]interface{}.
This is not a general-purpose JSON parser, and will not parse all valid JSON documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.
func FromJSONArray ¶
func FromJSONArray(str string) []interface{}
fromJSONArray converts a JSON array into a []interface{}.
This is not a general-purpose JSON parser, and will not parse all valid JSON documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string as the first and only item in the returned array.
func FromYAML ¶
fromYAML converts a YAML document into a map[string]interface{}.
This is not a general-purpose YAML parser, and will not parse all valid YAML documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.
func FromYAMLArray ¶
func FromYAMLArray(str string) []interface{}
fromYAMLArray converts a YAML array into a []interface{}.
This is not a general-purpose YAML parser, and will not parse all valid YAML documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string as the first and only item in the returned array.
func ToJSON ¶
func ToJSON(v interface{}) string
toJSON takes an interface, marshals it to json, and returns a string. It will always return a string, even on marshal error (empty string).
This is designed to be called from a template.
Types ¶
This section is empty.