ToJSON converts a single YAML document into a JSON document
or returns an error. If the document appears to be JSON the
YAML decoding path is not used (so that error messages are)
JSON specific.
NewYAMLOrJSONDecoder returns a decoder that will process YAML documents
or JSON documents from the given reader as a stream. bufferSize determines
how far into the stream the decoder will look to figure out whether this
is a JSON stream (has whitespace followed by an open brace).
type YAMLToJSONDecoder struct {
// contains filtered or unexported fields
}
YAMLToJSONDecoder decodes YAML documents from an io.Reader by
separating individual documents. It first converts the YAML
body to JSON, then unmarshals the JSON.
NewYAMLToJSONDecoder decodes YAML documents from the provided
stream in chunks by converting each document (as defined by
the YAML spec) into its own chunk, converting it to JSON via
yaml.YAMLToJSON, and then passing it to json.Decoder.