Questions tagged [kotlinx]

44 questions
0
votes
0 answers

How To Receive Bytes From Server?

the sever is sending me an array of arrays of bytes [[Byte]] or List>. A small sample looks like this [[102, 222, 111], [92, 22, 111], [142, 122, 32]] when writing this into a file, we get an executable, don't mean to compare with iOS but…
WiseEye
  • 133
  • 9
0
votes
0 answers

How can via kotlin mapOf map buttons key to value?

How can via Kotlin mapOf map buttons key to value? I have such code. reference to start_button is correct, by clickin on it I can open corect button in xml, but in debug mode buttonsMap value (start_button) is null. class StartDialog :…
Slava
  • 443
  • 4
  • 12
0
votes
2 answers

Is it possible to use kotlinx-datetime with Gson

I have JSON data which is retrieved from the local realm database. I'm trying to convert it into the corresponding data class. I have an ISO date field { .... "createdAt" : "2022-05-04T10:16:56.489Z" .... } What I'm trying to do is to…
Sreehari K
  • 887
  • 6
  • 16
0
votes
1 answer

Parse a dynamic nested JSON into Map<*, *> using Kotlinx.serialization

I need to parse any dynamic JSON (In the Kotlin Multiplatform project) to key-value pair and convert it to a nested list after. I started with the default .toMap() function, but it can't go deeper to parse ArrayList<*> Any idea how to do it? Sample…
0
votes
2 answers

java.util.Date to kotlinx.datetime.LocalDateTime

I have a value of type java.util.Date which was obtained from a legacy third-party API. Is there a direct way of converting it to kotlinx.datetime.LocalDateTime? I know how to do it only in a roundabout way, such as serializing to String and…
k314159
  • 5,051
  • 10
  • 32
0
votes
1 answer

Unresolved reference: kotlinx (Android Studio)

Unresolved reference: kotlinx.
Sergio Díaz
  • 79
  • 1
  • 7
0
votes
2 answers

Null or Empty Object parsing in Kotlinx.serialization

How to parse both types of responses: { "x" : "some_string" } and { "x" : { } } Into a data class that looks like: @Serializable data class SomeClass { @SerialName("x") val x : String? }
0
votes
2 answers

Kotlinx serialization of JSON Array to data class

For my Android app I try to parse a network response using Kotlinx serialization. The network response is a WebSocket Payload from Kraken and looks like a JSON array, that has elements without keys. I want to create a data class for this response…
Peter Renz
  • 23
  • 5
0
votes
1 answer

JsonDecodingException on valid Json with Ktor/Kotlinx

Why I get the following error at offset 6 with the following code. It makes an HTTP Request, gets a Json back, should go through the Json and create the object IMDBInfo. The json is valid, obviously processing, and the data class is as easy as it…
Jeremy T
  • 15
  • 3
0
votes
0 answers

kotlinx serialization. Deserialize generic parameter trouble

I am migrating my project serialization client from GSON to KotlinxSerialization and Faced a problem: All responses from API inherit an abstraction class for example: abstract class BaseResponse ( val type: String? = null, val payload: T? =…
0
votes
1 answer

How to fix nested arrays

I have a data model class CategoryModel: @Serializable data class CategoryModel (val name: String, val items: ArrayList) : java.io.Serializable {} And I am trying to use Serialize so I can store the data from this class into a Bundle to be…
Pwneill
  • 15
  • 1
  • 6
0
votes
1 answer

How to intercept deserialisation with kotlinx.serialization

For example, I have JSON { "url": "//n.ya.com" } In order to deserialize, I define the data class @Serializable data class Foo( @SerialName("url") val link: String, ) After deserializing the Foo object has foo.link with "//n.ya.com" How…
TeeTracker
  • 7,064
  • 8
  • 40
  • 46
0
votes
1 answer

kotlinx.serialization.cbor.CborDecodingException: Expected start of map, but found 78

I was trying to use one of the Kotlin's serialization package with the following custom example class. I will extend this class matching the real use case by adding a List of the real class (which also need to be serialized), but right now the…
Marco Ottina
  • 399
  • 5
  • 12
-2
votes
1 answer

Kotlin kotlinx-serialization-csv multi array list

Does anyone know how to deserialize a csv containing multiarray list: Code, values 1234, [[11111, 22222], [44444, 99999]]
Armin
  • 125
  • 2
  • 6
1 2
3