You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-18 22:57:33 +02:00
support Any as field type
This commit is contained in:
@ -36,4 +36,17 @@ func Test_iterator_and_bind_api(t *testing.T) {
|
||||
iter.ReadVal(&user)
|
||||
iter.ReadArray() // array end
|
||||
fmt.Println(user)
|
||||
}
|
||||
}
|
||||
|
||||
type TaskBidLog struct {
|
||||
age int
|
||||
}
|
||||
|
||||
func Test2(t *testing.T) {
|
||||
rawString :=`
|
||||
{"id":0,"bidId":"bid01492692440885","impId":"imp0","taskId":"1024","bidPrice":80,"winPrice":0,"isWon":0,"createTime":1492692440885,"updateTime":null,"device":"","age":30,"gender":"","location":"[中国, 山西, , ]","conType":"0","os":"iOS","osv":"","brand":"","geo":"","ip":"1.68.4.193","idfa":"","waxUserid":""}`
|
||||
var log TaskBidLog
|
||||
err := UnmarshalFromString(rawString, &log)
|
||||
fmt.Println(err)
|
||||
fmt.Println(log.age)
|
||||
}
|
||||
|
Reference in New Issue
Block a user