-
Notifications
You must be signed in to change notification settings - Fork 550
Closed
Description
问题描述
Kotlin 反序列化错误
环境信息
请填写以下信息:
- OS信息: [e.g.:macOS 12.3.1]
- JDK信息: [e.g.:Oracle JDK 11.0.11]
- Kotlin信息: [e.g.:1.6.20]
- 版本信息:[e.g.:fastjson2-kotlin 2.0.3]
重现步骤
如何操作可以重现该问题:
@Test
fun testKotlin() {
val json = """
{"access_token":"MTUZNGNKNMITZTVMMC0ZYTY0LWFIZJCTMZJLMDIYMMY4OGUW","scope":""}
""".trimIndent()
val accessTokenResponse = JSON.parseObject(json, AccessTokenResponse::class.java)
log.info(accessTokenResponse.toString())
}
data class AccessTokenResponse(
@JSONField(name = "access_token")
var accessToken: String? = null,
@JSONField(name = "expires_in")
var expiresIn: Int? = null,
@JSONField(name = "scope")
var scope: String? = null,
@JSONField(name = "token_type")
var tokenType: String? = null
): Serializable期待的正确结果
AccessTokenResponse(accessToken=MTUZNGNKNMITZTVMMC0ZYTY0LWFIZJCTMZJLMDIYMMY4OGUW, expiresIn=null, scope=, tokenType=null)
相关日志输出
请复制并粘贴任何相关的日志输出。
附加信息
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
