mirror of
https://github.com/json-iterator/go.git
synced 2024-12-09 08:55:35 +02:00
19 lines
372 B
Go
19 lines
372 B
Go
package extra
|
|
|
|
import (
|
|
"github.com/json-iterator/go"
|
|
"github.com/json-iterator/go/require"
|
|
"testing"
|
|
)
|
|
|
|
func Test_private_fields(t *testing.T) {
|
|
type TestObject struct {
|
|
field1 string
|
|
}
|
|
SupportPrivateFields()
|
|
should := require.New(t)
|
|
obj := TestObject{}
|
|
should.Nil(jsoniter.UnmarshalFromString(`{"field1":"Hello"}`, &obj))
|
|
should.Equal("Hello", obj.field1)
|
|
}
|