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

Rename fields when generating map encodings #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hannahhoward
Copy link
Contributor

Goals

Allow using keys other than the actual field name when generating map encodings.

Implementation

If a struct field has a tag with key "json", use that as the "name" for the field when generating a map encoder as opposed to the actual field's name. (otherwise just use the name)

This has a number of potential uses:

  1. using shorter key names for size concerns
  2. being able to rename struct fields without breaking compatibility with old versions.

if a struct field has a tag with key "json", use that in generating a map encoder as opposed to the
var name --> allows field renames on map encoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant