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
Hi, great work. May I suggest adding a parameter to the JsonObject annotation to override default naming conventions.
such:
@JsonObject(fieldRename:FieldRename.snakeCase)
class Person{
final firstName;
}
``
to make the generated Json:
`"{'first_name':'Bob'}"`
instead of :
`"{'firstName':'Bob'}"`
Why? because most the API's I've worked with(might be biased) use snake_cased variables and dart encourages camelCasing.
I know this is currently avalable via the @JsonProperty name field but it is quite tedious to rename each field of a model , specially if it is a big one(although doable).
Let me know if this is a desirable feature, I might try to land a PR if that's the case.
The text was updated successfully, but these errors were encountered:
@fabiancrx Thanks for the feedback and idea. Yes, it would be great to support a way to recase the fields to other cases. PR is welcome to add this feature.
It would be great to support some of the popular casing strategies like snake, kebab, pascal, camel, etc in the FieldRename enum. I would recommend using the recase lib for the casing implementations.
Also, eventually it would be good to support the field renaming at the CustomJsonMapper level (runtime) to allow users to have this configured globally or on a mapper instance level. This will help with eliminating the need to repeat the same fieldRename for every class.
Let me know if you have any troubles or need any guidance.
Hi, great work. May I suggest adding a parameter to the JsonObject annotation to override default naming conventions.
such:
The text was updated successfully, but these errors were encountered: