Files
liv/pkg/encoding/json/json_test.go
Justyer a0182af97d fix
2024-10-17 17:35:06 +08:00

25 lines
411 B
Go

package json_test
import (
"fmt"
"testing"
"github.com/fxkt-tech/liv/pkg/encoding/json"
)
func TestPretty(t *testing.T) {
x := []byte(`{"x":1}`)
fmt.Println(json.Pretty(x))
}
type Person struct {
Name string `json:"name,omitempty"`
Age int `json:"age,omitempty"`
}
func TestToObjectT(t *testing.T) {
b := []byte(`{"name":"xx","age":1}`)
x := json.ToV[*Person](b)
fmt.Println(x.Name, x.Age)
}