Feature request: support kotlinx.serialization
yrom opened this issue · comments
Hi @wuseal ,very thanks for your awesome work.
Could you add support for the project kotlinx.serialization ?
- Class should annotated with
@Serializable
@Optional
for optional property, but require default values@SerialName
for override property name with custom name
e.g.
@Serializable
class Data(val a: Int = 0,
@Optional val b: Int = 42,
@SerialName("c") val custom: String)
assertEquals("{a: 1, b: 42, c: test}", JSON.unquoted.stringify(Data(custom="test")))
@yrom Of course ! Thanks for your awesome advice ,It will be complete in Version 1.7 about one week later.
@yrom Hi,Version,1.7Pre1 has released ,you can download the jar
and install plugin local Download the plugin
It add custom annotation with class and multiple annotation with property ,you could fix your request by select Others by customize
option in annotation tab, the demo result code could like this:
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
import kotlinx.serialization.Optional
@Serializable
data class TestData(
@Optional
@SerialName("data")
var data: Data = Data(),
@Optional
@SerialName("state")
var state: Int = 0,
@Optional
@SerialName("err")
var err: Any = Any()
)
The config dialog like this:
If there any problem ,Welcome to raise ,Em.. In this pre version ,I have a headache with the UI.If possible,Any one could help to optimize that ,Thanks.!
Looks good! I'll try it
close this issue ,If any problem welcome to reopen or raise new issue,tks 😄