google / google/built_value.dart

Set global field naming policy for Json serialization

Open
#743 4 comments 9 reactions 1 assignee Claimed by @davidmorgan View on GitHub
p1 / feature request
Dominant language
Dart
Stars
886
Forks
195
Avg merge
1d 11h
Merged PRs (30d)
4

Description

It would be convenient if we could set field naming policy for Json serialization globally.

I am aware that:
- It is possible to change single field naming via `BuiltValueField`. *But* it is cumbersome to do this for thousands of fields. And more often devs wants to set global policy instead of having fields with different naming conventions.
- It is possible to add additional serialization plugin for renaming. *But* that is not optimal from performance and logic side. Json plugin is responsible for converting dart objects to Json representation. It already does key name generation by looking into field name or using BuiltValueField value.

Every single json serializer I used with Java (GSON, Jackson, Moshi) have such functionality. So IMHO this is `StandardJsonSerializer` responsibility. WDYT?

related https://github.com/google/built_value.dart/issues/144

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.