google / json_serializable.dart

Generates utilities to aid in serializing to/from JSON.
https://pub.dev/packages/json_serializable
BSD 3-Clause "New" or "Revised" License
1.54k stars 392 forks source link

[Enhancement] more options for `FieldRename` #1407

Open lucavenir opened 4 months ago

lucavenir commented 4 months ago

Thank you for providing the FieldRename enum. It quickly helps for common conventions.

It's great, but some backends adopt some weird naming conventions. I recently had to interface my client towards a server that returns only lowercase json fields, e.g.

{
  "somevaluewithnocase": 9
}

The fact that this is even a thing is very much debatable, thus making this request kind-of low-priority, but I was wondering if we could add more options for FieldRename, like for this one, above.

One good and complete list might be the following from mason. As you can see, there, we're pretty much allowed to do anything (obviously, it's a completely different context, and indeed there's some overlap, but you get the general idea). https://docs.brickhub.dev/brick-syntax#built-in-lambdas