Skip to content

Default renaming of variables to other cases(eg:snake_case) #4

Description

@fabiancrx

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions