增加Map MarshalJSON 方法
This commit is contained in:
17
map_test.go
17
map_test.go
@ -28,3 +28,20 @@ func TestMap_IsNil(t *testing.T) {
|
||||
fmt.Println(m.Set("a", 1))
|
||||
fmt.Println(m.IsNil(), m1.IsNil())
|
||||
}
|
||||
|
||||
func TestMap_IsMasher(t *testing.T) {
|
||||
var (
|
||||
m Map
|
||||
m1 = Map(map[string]any{
|
||||
"a": 1,
|
||||
"b": m,
|
||||
"c": Map(map[string]any{
|
||||
"name": "de",
|
||||
}),
|
||||
})
|
||||
)
|
||||
d, err := m.MarshalJSON()
|
||||
fmt.Println(string(d), err)
|
||||
d, err = m1.MarshalJSON()
|
||||
fmt.Println(string(d), err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user