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
I'd like to apply a normalization function on the field names when deserializing to serde_json::Value.
let field_normalizer = |name: &str| { return name.to_lowercase().replace("#", "_"); }; let value: Value = serde_json::from_str_with_custom_normalizer(r#"{"Field_1": 1, "Field#2": 2}"#, field_normalizer)?; dbg(&value);
The value displayed by the dbg macro should be:
[main.rs:10] &value = Object({ "field_2": Number( 2, ), "field_1": Number( 1, ), })
I'm well aware of the possible name collision after normalization but I have a mechanism to deal with that.
How can I implement a such custom generic deserialization without creating a modified copy of a Value?
The text was updated successfully, but these errors were encountered:
Please take this question to one of the resources listed in https://github.com/serde-rs/serde/tree/v1.0.135#getting-help. Sorry that no one was able to provide guidance here.
Sorry, something went wrong.
No branches or pull requests
I'd like to apply a normalization function on the field names when deserializing to serde_json::Value.
The value displayed by the dbg macro should be:
I'm well aware of the possible name collision after normalization but I have a mechanism to deal with that.
How can I implement a such custom generic deserialization without creating a modified copy of a Value?
The text was updated successfully, but these errors were encountered: