To clarify I did not use a custom serializer, for anything here. The initial deserialization is correct, the Json -> Kotlin conversion is correct, transforming it back from Kotlin -> Json is still correct but the standard serializer when you annotate your class with writes BigDecimal and BigIntegers as Double and Long respectively. Because the standard serializer for JsonArray writes Numbers as either Long or Double. 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. Var deserializedJson= codeFromString(JsonClassSerializer, jsonToParse) var convertedKotlin= convertJsonToKotlin(deserializedJson) var convertedJson= convertKotlinToJson(convertedKotlin) var serializedJson= generateJsonOutputFromKotlin(convertedJson, json)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |