google / google/json_serializable.dart
Feature request: support storing the unused values while decoding in a special field
Open
Type: enhancement
- Dominant language
- Dart
- Stars
- 1.6k
- Forks
- 461
- Avg merge
- 45m
- Merged PRs (30d)
- 1
Description
I have a situation where the fields of a map are always changing and I need to expose some metadata that is consistent but also the data fields.
Looking for something like this:
```dart
@JsonSerializable(createToJson: false)
class Entry {
final Meta meta;
@JsonKey(restJson: true)
final Map data;
Entry(this.meta, this.data);
factory Entry.fromJson(Map json) => _$EntryFromJson(json);
}
```
The idea is that the entire json map would be stored at Entry.data and would be packaged up with all of its metadata.
Is there any way to achieve this today?
Contributor guide
Assessment
This issue has not been assessed yet.