With kotlinx-serialization, I want to be able to a...
# serialization
j
With kotlinx-serialization, I want to be able to annotate a property as
@Ref
and have the serializer only serialize the
id
property of the referenced type. Is this possible? I.e.
Copy code
data class Video(
    val name: String,
    @Ref val user: User,
)

// serialized to:

{
    name: "example",
    user: {
        id: "123"
    }
}
e
I'm not sure how you expect deserialization to work, but…
👍 1
d
If you don’t necessary need JSON - I wrote a library that serializes/deseeializes to binary with Amazon IoN that retains object references. https://github.com/dimitark/kotlinx-serialization-ion
j
@ephemient looks good cheers!