transcodefmt

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 7 Imported by: 0

README

transcodefmt is a yaml/json conversion library

transcodefmt encodes yaml into json and vice versa while preserving the order and structure of the data.

  • aliases are not supported
  • comments are obviously lost

Please feel free to open issues or contribute if you feel so inclined.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONFromYAML added in v0.1.0

func JSONFromYAML(yamlData []byte) ([]byte, error)

func YAMLFromJSON added in v0.1.0

func YAMLFromJSON(jsonData []byte) ([]byte, error)

Types

type Transcoder added in v0.1.0

type Transcoder struct {
	Indent int
	// contains filtered or unexported fields
}

func New added in v0.1.0

func New(w io.Writer) Transcoder

func (Transcoder) JSONFromYAML added in v0.1.0

func (t Transcoder) JSONFromYAML(yamlData io.Reader) error

JSONFromYAML transcodes YAML contained in yamlData

Multiple documents are not supported.

func (Transcoder) YAMLFromJSON added in v0.1.0

func (t Transcoder) YAMLFromJSON(jsonData io.Reader) error

YAMLFromJSON transcodes JSON contained in jsonData into YAML

Transcoding multiple items are not supported. Each root record will be seperated by "---"

Jump to

Keyboard shortcuts

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