simc / crimson

Fast, efficient and easy-to-use JSON parser and serializer for Dart.
Apache License 2.0
229 stars 6 forks source link

Add rename field to json annotation and build.yaml #6

Closed Reprevise closed 1 year ago

Reprevise commented 1 year ago

Due to varying field naming conventions, Crimson should have support for renaming all fields in a class by providing an enum value to the json annotation with whatever case the fields come in. All that is provided currently is the name field on the JsonField annotation. json_serializable has support for kebab, screamingSnake, pascal, and snake via its FieldRename enum. This should also apply to enums as well.

simc commented 1 year ago

Just implemented this. You can now use @jsonKebabCase and @jsonSnakeCase. Check out the readme 🙂