Categorygithub.com/go-zoox/fmt
repositorypackage
1.0.0
Repository: https://github.com/go-zoox/fmt.git
Documentation: pkg.go.dev

# README

Fmt - Pretty Data Display, Inlcude JSON/YAML/TOML/INI ...

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/fmt

Getting Started

import (
  "testing"
  "github.com/go-zoox/fmt"
)

func main(t *testing.T) {
		type User struct {
		Name    string
		Age     int
		Address struct {
			City   string
			Street string
		}
		Hobbies []string
	}

	user := User{
		Name: "Zero",
		Age:  18,
		Address: struct {
			City   string
			Street string
		}{
			City:   "Shanghai",
			Street: "Nanjingxi Road Street",
		},
		Hobbies: []string{"sport", "music", "movies"},
	}

	fmt.Println("JSON Format:")
	fmt.PrintJSON(user)
	fmt.Println("\nYAML Format:")
	fmt.PrintYAML(user)
	fmt.Println("\nTOML Format:")
	fmt.PrintTOML(user)
	// Println("\nINI Format:")
	// PrintINI(user)
	fmt.Println("\nRaw Format:")
	fmt.Println(user)
}

License

GoZoox is released under the MIT License.