kmfkwheels.blogg.se

Kotlin data class serializable
Kotlin data class serializable











kotlin data class serializable kotlin data class serializable

Then that instance is converted back into a JsonClass instance, because we can't serialize Any types.įinally the json output is generated from that JsonClass and here the problem arises. Then I convert that object into a different a different type that contains useable data types like for val x: List> and stuff like that. I took a JSON file as String input, configured my Json object and then decoded that input into an object instance of some JsonClass containing properties like val x: JsonArray and so on. The above sequence is what I went through.

kotlin data class serializable

Var deserializedJson= codeFromString(JsonClassSerializer, jsonToParse) var convertedKotlin= convertJsonToKotlin(deserializedJson) var convertedJson= convertKotlinToJson(convertedKotlin) var serializedJson= generateJsonOutputFromKotlin(convertedJson, json)













Kotlin data class serializable