You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can support for custom tag while marshalling and unmarshalling struct be added to the library ?
Usecase -
We receive json response in wierd key name but while storing and forwarding the same response I want to fix the key names in response.
Current solution -
I am aware that I can create 2 struct like below and typecast them
type Incoming struct {
Name string `cust:"n"`
Age string `cust:"a"`
}
type Out struct {
Name string `json:"name"`
Age string `json:"age"`
}
incoming := Incoming{Name: "name", age: "25"}
out := Out(incoming)
This would give exactly the same result but would require me to maintain 2 exactly same structs.
Therefore I was wondering if we can directly add the support for custom tag which would be ewxposed with Options flag
I have implemented the same in my forked version - master...jsjain:go-json:master
Activity