To install the package, run:
go get github.com/go-zoox/fmt
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)
}
GoZoox is released under the MIT License.