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
The main json module has a skippable struct fields feature, so fields on the struct don't get encoded / decoded
structFoo {
x int @[json: '-'] // This field doesn't get encoded/decoded
y int
z int
}
Use Case
I wanted a way to encode a struct that didn't envolve mapping it to another struct, because only one field had to be hidden from json.
I could've used the main json module, but the way it encodes time.Time as a number doesn't work for me
Proposed Solution
Implement the @[json: '-'] attribute to skip struct fields
Describe the feature
The main
json
module has a skippable struct fields feature, so fields on the struct don't get encoded / decodedUse Case
I wanted a way to encode a struct that didn't envolve mapping it to another struct, because only one field had to be hidden from json.
I could've used the main
json
module, but the way it encodestime.Time
as a number doesn't work for meProposed Solution
Implement the
@[json: '-']
attribute to skip struct fieldsOther Information
No response
Acknowledgements
Version used
V 0.4.4 c9933da.10c2f9e
Environment details (OS name and version, etc.)
OS: linux, Ubuntu 22.04.3 LTS (WSL 2)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: