pkgyaml

package
v0.0.0-...-15a92f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package pkgyaml provides functionality for YAML.

Originally inspired by https://github.com/bronze1man/yaml2json.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseYAMLOrJSON

func ParseYAMLOrJSON(filePath string, v interface{}) (retErr error)

ParseYAMLOrJSON unmarshals the given file at filePath, switching based on the file extension.

This uses the json tags on any fields, as json.Unmarshal is the unmarshalling function used.

func ToJSON

func ToJSON(p []byte, opts ToJSONOptions) ([]byte, error)

ToJSON transforms an YAML input and transforms it to JSON.

Originally inspired by https://github.com/bronze1man/yaml2json.

Types

type ToJSONOptions

type ToJSONOptions struct {
	// Pretty says to output the JSON with json.MarshalIndent.
	Pretty bool
	// Indent is the string to use for indenting. This only applies
	// if Pretty is set. The default is "\t".
	Indent string
}

ToJSONOptions are the options to pass to ToJSON.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL