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 I intercept Marshalling/Unmarshalling to skip some fields?
The desired goal is to have one struct with one set of fields, which have a different behavior during serialization/deserialization, so json:"-" is not an option. By using ast.Visitor, I should either implement it for each struct, which is a lot or use reflect, which will probably drop the performance significantly.
It would be nice to have an interface that can skip Serialization/Deserialization if implemented.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Can I intercept Marshalling/Unmarshalling to skip some fields?
The desired goal is to have one struct with one set of fields, which have a different behavior during serialization/deserialization, so
json:"-"
is not an option. By usingast.Visitor
, I should either implement it for each struct, which is a lot or use reflect, which will probably drop the performance significantly.It would be nice to have an interface that can skip Serialization/Deserialization if implemented.
Or maybe there are any other better ways to do what I want?
Thanks for your hard work on the project btw, it's awesome!
Beta Was this translation helpful? Give feedback.
All reactions