Giter VIP home page Giter VIP logo

json2yaml's Introduction

json2yaml

CI Status Go Report Card MIT License release pkg.go.dev

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.

Usage as a command line tool

json2yaml file.json ...
json2yaml <file.json >output.yaml

You can combine with other command line tools.

gh api /orgs/github/repos | json2yaml | less

Usage as a library

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!
}

Installation

Homebrew

brew install itchyny/tap/json2yaml

Build from source

go install github.com/itchyny/json2yaml/cmd/json2yaml@latest

Bug Tracker

Report bug at Issues・itchyny/json2yaml - GitHub.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

json2yaml's People

Contributors

itchyny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.