json-iterator/go

any ObjectValue does not support toVal()

TCBeliever opened this issue · 0 comments

     p := DataTime{
         DateFormat: "yyyy/MM/dd",
         TimeFormat: "HH:mm",
     }
     any := jsoniter.Wrap(p)
     t.Logf("type object:%v", any.ValueType() == jsoniter.ObjectValue)
     t.Logf("string:%v", any.ToString())

     s, _ := jsoniter.MarshalToString(any)
     t.Logf("serial json:%v", s)
     any.ToVal(&p)
     t.Logf("to object:%v", p)

this code MarshalToString has empty result,
and panic when any.ToVal()
any suggestion?