yaml

package
v2.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package yaml implements a converter from JSON to YAML.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(w io.Writer, r io.Reader) error

Convert reads JSON from r and writes YAML to w.

Example
package main

import (
	"fmt"
	"log"
	"strings"

	json2yaml "github.com/danielgtaylor/huma/v2/yaml"
)

func main() {
	input := strings.NewReader(`{"Hello": "world!"}`)
	var output strings.Builder
	if err := json2yaml.Convert(&output, input); err != nil {
		log.Fatalln(err)
	}
	fmt.Print(output.String())
}
Output:

Hello: world!

Types

This section is empty.

Jump to

Keyboard shortcuts

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