Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x.json2] Add skippable struct fields @[json: '-'] #20890

Closed
1 of 2 tasks
johnpgr opened this issue Feb 22, 2024 · 1 comment
Closed
1 of 2 tasks

[x.json2] Add skippable struct fields @[json: '-'] #20890

johnpgr opened this issue Feb 22, 2024 · 1 comment
Labels
Feature Request This issue is made to request a feature.

Comments

@johnpgr
Copy link
Contributor

johnpgr commented Feb 22, 2024

Describe the feature

The main json module has a skippable struct fields feature, so fields on the struct don't get encoded / decoded

struct Foo {
    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

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

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.

@johnpgr johnpgr added the Feature Request This issue is made to request a feature. label Feb 22, 2024
@johnpgr
Copy link
Contributor Author

johnpgr commented Feb 22, 2024

I can work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request This issue is made to request a feature.
Projects
None yet
Development

No branches or pull requests

1 participant