You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to java.lang.String
at JSONTestKt.main(JSONTest.kt:31)
at JSONTestKt.main(JSONTest.kt)
The text was updated successfully, but these errors were encountered:
展示例子如下:
`import com.alibaba.fastjson.JSON
import kotlinx.serialization.Serializable
import java.util.*
import kotlin.collections.HashMap
@serializable
class Project(val name: String, val language: String)
//bug test
fun main(){
val map = HashMap<Any,Any>()
val user = Project("hello", "hello")
map.put(user, user)
val result = JSON.toJSONString(map)
System.out.println(result)
val back = JSON.parseObject(result)
System.out.println(back.keys.size)
back.keys.forEach {
System.out.println(it + " dd ")
}
System.out.println( " ")
}`
凡序列化异常:
Exception in thread "main" java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to java.lang.String
at JSONTestKt.main(JSONTest.kt:31)
at JSONTestKt.main(JSONTest.kt)
The text was updated successfully, but these errors were encountered: