We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In Crystal, enums are serialized to member names by default.
It would be great to have a choice between names and values in JSON/YAML too.
A slight complication is that, in the case of Flags Enums, the serialization ends up being an array with all active members listed: https://github.com/crystal-lang/crystal/blob/b88b842d425de7ce2a74c1acf82b30c447e1b254/src/json/to_json.cr#L198
And that requires more meta information to be passed to the (de)serialize overloads for Enums than that which is currently available.
The text was updated successfully, but these errors were encountered:
Serialize Enum members as strings
be67f74
Solves #20.
Serialize Enum members as strings (#21)
f6e39c6
No branches or pull requests
In Crystal, enums are serialized to member names by default.
It would be great to have a choice between names and values in JSON/YAML too.
A slight complication is that, in the case of Flags Enums, the serialization ends up being an array with all active members listed:
https://github.com/crystal-lang/crystal/blob/b88b842d425de7ce2a74c1acf82b30c447e1b254/src/json/to_json.cr#L198
And that requires more meta information to be passed to the (de)serialize overloads for Enums than that which is currently available.
The text was updated successfully, but these errors were encountered: