Is it possible to get the original property name i...
# serialization
j
Is it possible to get the original property name in a class descriptor, even if it has a
@SerialName
annotation?
a
no,
@SerialName
will be the only name that’s in a
SerialDescriptor
why do you want to get the actual property name?
j
looking for a way to get a KProperty's SerialName and actual name. The KProperty provides the name but there is no way to get the serial name with that name right?
a
There might be... It depends on what you want to do. What problem would be solved by having both names?
j
I mean the problem is Kotlin/JS as you cant get annotations when having a KProperty like Kotlin/JVM. I theoretically only want the serial name but I need to map it to a KProperty
In the end the syntax looks like this:
Copy code
Person::name eq "some name"
On Kotlin/JVM I can just get the SerialName annotation on the KProperty
a
Sorry, I don't really understand what you mean. I understand that you want to get the property name and serial name, but what do you want to do with both names? Because there's lots of ways that you might be able to work around it (KSP, a custom annotation...)