Could json-iterator support auto lowercase json field?
code example:
type User struct {
ID int `json:"-"`
Name string
Age int
Email string
QQNumber string `json:"QQ"`
}
user := User{
ID: 1,
Name: "MJ",
Age: 51,
Email: "mj@qq.com",
QQNumber: "20090625",
}
b, _ := jsoniter.Marshal(user)
fmt.Println(string(b))
// we need a function like `MarshalSmart`, it can auto lowercase the first letter of json fileds if the struct field has no json tag defined.
b, _ := jsoniter.MarshalSmart(user)
fmt.Println(string(b))
Could json-iterator support auto lowercase json field?
code example:
prefer output:
the same as
jsoniter.UnMarshalSmart