-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.Used for miscellaneous pkg/ packages not associated with specific area- teams.pkg-jsonThe json macro packageThe json macro packagetype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Description
The new JsonCodable
macro in Dart is a great feature for JSON serialization, but it currently lacks support for custom JSON key mappings. This makes it difficult to map Dart fields to JSON keys with different naming conventions (e.g., fileName
in Dart to file_name
in JSON).
Example:
@JsonCodable()
class AudiosItem {
final String id;
// No support for custom JSON key mappings like this:
// @JsonKey(name: 'file_name') or @JsonField(name: 'file_name')
final String fileName;
const AudiosItem({
required this.fileName,
required this.id,
});
}
Luca-CZ and mcmah309
Metadata
Metadata
Assignees
Labels
area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.Used for miscellaneous pkg/ packages not associated with specific area- teams.pkg-jsonThe json macro packageThe json macro packagetype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug