google / google/json_serializable.dart

Support nullable `fromJson`

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

Description

I have a type I get from a php project, which looks a bit like this:
```json
{
"object": "user",
"attributes": {...}
}
```

And sometimes, that object can be nested

```dart
{
"object": "user",
"attributes": {
"thing": {
"object": "item"
"attributes": {...}
}
}
}
```
This is fine.

What _isnt_ fine, however, is the `null_resource` object, which looks like this:
```dart
{
"object": "null_resource",
"attributes": null // <<<<<<<<<<
}
```
uh oh. I dont want two layers of null!

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.