Skip to content
/ fmt Public

Format UTILS, extends fmt, support fmt.PrintJSON, fmt.PrintYAML, fmt.PrintTOML, fmt.PrintINI, etc.

License

Notifications You must be signed in to change notification settings

go-zoox/fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Format UTILS, extends fmt, support fmt.PrintJSON, fmt.PrintYAML, fmt.PrintTOML, fmt.PrintINI, etc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages