Closed yankooo closed 1 year ago
for example:
func Test_customize_field_by_extension(t *testing.T) { should := require.New(t) cfg := jsoniter.Config{}.Froze() cfg.RegisterExtension(&testExtension{}) obj := TestObject1{} err := cfg.UnmarshalFromString(``, &obj) should.Nil(err) }
expect: err is nil, but err: "Read: unexpected value type: 0, error found in #0 byte of ...||..., bigger context ...||..."。
can't understand this error is a valid case?
An empty string is not valid json. The stdlib throws an error as well: unexpected end of JSON input.
unexpected end of JSON input
To answer your question, yes this error is valid.
for example:
expect: err is nil, but err: "Read: unexpected value type: 0, error found in #0 byte of ...||..., bigger context ...||..."。
can't understand this error is a valid case?