google / google/json_serializable.dart

"createFromJson" for `@JsonSerializable` to turn on/off deserialization code generation

Open
#1,382 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.6k
Forks
461
Avg merge
45m
Merged PRs (30d)
1

Description

Hi,

I have a class that only requires serialization to JSON but not deserialization.

For specific fields there is `includeFromJson` property for `JsonKey`.

Can we get the same for the whole class?

```dart
@JsonSerializable(createFromJson: false)
class MyClassThatOnlyNeedsSerialization {
// ...
}
```

Thanks! :)

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.