5/6/2023 0 Comments Serializable kotlin![]() To serialize the data class Person into JSON, we need to include the Serializable annotation in the class: import Serializable data class Person ( val gender. ![]() ![]() JavaBeanInfo if(paramNames ! = null types.length = paramnames. Firstly, let’s discuss briefly how we can serialize and deserialize objects in Kotlin using Kotlin’s out-of-the-box kotlinx-serialization library. What causes subsequent deserialization to fail?įrom the above exception information, you can find the code segment that threw the exception, as follows: Class: com.Why is deserialization normal at first?.It seems natural to throw the above exception, but there are two problems: The definition of the Test class is as follows: data class Test( val name: String)Īs you can see, the Test class does not have a default constructor. See above exception message is the Test class The default constructor could not be foundAfter a while, the same problem will occur again. ![]() However, after running for some time, when the interface is called again, the following exceptions will be found: Method threw '' exception: default constructor not found. When the service is started, the interface is called normally. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |