An efficient JSON to YAML converter written in Go language
Go
71
77 commits
updated Sep 13, 2026
This is an implementation of JSON to YAML converter written in Go language. This tool efficiently converts each JSON tokens in streaming fashion, so it avoids loading the entire JSON on the memory. Also, this tool preserves the order of mapping keys and the number representation.
json2yaml file.json ...
json2yaml <file.json >output.yaml
You can combine with other command line tools.
gh api /meta | json2yaml | less
You can use the converter as a Go library.
json2yaml.Convert(io.Writer, io.Reader) error is exported.
package main
import (
"fmt"
"log"
"strings"
"github.com/itchyny/json2yaml"
)
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()) // outputs Hello: world!
}
brew install itchyny/tap/json2yaml
go install github.com/itchyny/json2yaml/cmd/json2yaml@latest
Report bugs at Issues・itchyny/json2yaml - GitHub.
itchyny (https://github.com/itchyny)
This software is released under the MIT License, see LICENSE.
Overall
Maintained
Code review
Go module
Latest release
Releases this year
543 followers · starred Jan 2024
105 followers · starred May 2024
An efficient JSON to YAML converter written in Go language
Go
71
77 commits
updated Sep 13, 2026
This is an implementation of JSON to YAML converter written in Go language. This tool efficiently converts each JSON tokens in streaming fashion, so it avoids loading the entire JSON on the memory. Also, this tool preserves the order of mapping keys and the number representation.
json2yaml file.json ...
json2yaml <file.json >output.yaml
You can combine with other command line tools.
gh api /meta | json2yaml | less
You can use the converter as a Go library.
json2yaml.Convert(io.Writer, io.Reader) error is exported.
package main
import (
"fmt"
"log"
"strings"
"github.com/itchyny/json2yaml"
)
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()) // outputs Hello: world!
}
brew install itchyny/tap/json2yaml
go install github.com/itchyny/json2yaml/cmd/json2yaml@latest
Report bugs at Issues・itchyny/json2yaml - GitHub.
itchyny (https://github.com/itchyny)
This software is released under the MIT License, see LICENSE.
Overall
Maintained
Code review
Go module
Latest release
Releases this year
543 followers · starred Jan 2024
105 followers · starred May 2024