google / google/json_serializable.dart

Question: Will this packages support `extension types` like `kotlinx.serialization`?

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

Description

Kotlin's JSON serialization library(`kotlinx.serialization`) supports the value class in the following way:

Code:
```kotlin
@Serializable
@JvmInline
value class Color(val rgb: Int)

@Serializable
data class NamedColor(val color: Color, val name: String)

fun main() {
println(Json.encodeToString(NamedColor(Color(0), "black")))
}
```
Json:
```JSON
{"color": 0, "name": "black"}
```

I'm wondering if this package will support Json serialization in a similar way to Kotlin.

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.