Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
266 views

I'm migrating from Java's java.time API to kotlinx-datetime and need to format dates with custom patterns. In Java, I was using: date.plusDays((number - 1).toLong()) .format(DateTimeFormatter....
Pawandeep Singh's user avatar
1 vote
0 answers
83 views

I have a couple of data classes like below data class Base ( val prop1: String, val prop2: String ) data class Derived ( val base: Base, val prop3: String ) The serialized form of Derived ...
Pazhamalai Arun's user avatar
1 vote
1 answer
700 views

I have a kotlinx JsonElement at hand, and I want to pretty-print it. How do I do that? The only methods I see for pretty-print need a data class, but my element does not fit any specific class. //EDIT:...
ModdyFire's user avatar
  • 826
1 vote
1 answer
1k views

I have a JSON response with a parameter which may be of different types depending on the enum value of another parameter. Example JSON: [ { "type":1, "value":&...
Marc's user avatar
  • 109
0 votes
0 answers
124 views

the sever is sending me an array of arrays of bytes [[Byte]] or List<List<Byte>>. A small sample looks like this [[102, 222, 111], [92, 22, 111], [142, 122, 32]] when writing this into a ...
WiseEye's user avatar
  • 193
4 votes
2 answers
2k views

I would like to generate a bunch of HTML files with kotlinx-html and I want to start each file with the same template. I would like to have a function for the base structure and provide a lamda to ...
ChrLipp's user avatar
  • 15.7k
6 votes
0 answers
6k views

I tried to enable HTML strings, especially with links e.g.: "We are a <a href="/about/about_team.htm">team</a> of professionals working hard to provide free learning content....
Ralf Wickum's user avatar
  • 3,178
0 votes
1 answer
1k views

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 ...
nes's user avatar
  • 81
1 vote
2 answers
3k views

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 ...
k314159's user avatar
  • 12.4k
0 votes
1 answer
5k views

Unresolved reference: kotlinx.
Sergio Díaz's user avatar
3 votes
1 answer
2k views

Note: I'm completely new to the Kotlin / JUnit ecosystem, so please bear with me if the question is missing something basic. I'm working on a JSON-based file format. In the unit/integration tests, I'd ...
bluenote10's user avatar
  • 27.3k
4 votes
1 answer
2k views

I have a Json input like: { "type": "type_1", "data": { // ... } } data field can vary depending on type. So, I need a deserializer, that looks on type (...
artem's user avatar
  • 16.8k
0 votes
1 answer
2k views

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 ...
Jeremy T's user avatar
3 votes
2 answers
7k views

I want to make a custom List serializer that will parse invalid json arrays safely. Example: list of Int [1, "invalid_int", 2] should be parsed as [1, 2]. I've made a serializer and added it ...
Wackaloon's user avatar
  • 2,405
4 votes
3 answers
2k views

I am using Kotlin's html library kotlinx.html for dynamic html building. I want to create a button which triggers a function when clicked. This is my current code: class TempStackOverflow(): Template&...
Lekkkim's user avatar
  • 43
2 votes
1 answer
3k views

I try to write a data class for the following JSON response from a public API: { "error": [], "result": { "AAVE": { "aclass": "currency",...
Peter Renz's user avatar
1 vote
0 answers
372 views

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 <T&...
Gennadiy's user avatar
3 votes
1 answer
2k views

Kotlinx docs don't seem to cover this, I am wondering if there is a way to write a custom Serializer for an existing class. In my case, I need to serialize PointF and Color. For PointF, I have done ...
Amir J's user avatar
  • 123
9 votes
4 answers
9k views

I am getting this error while trying to read the bundle from another fragment where I am sending the NewVehicle object. Error : Class 'NewVehicle' is not abstract and does not implement abstract ...
Sweta Jain's user avatar
  • 4,482
3 votes
1 answer
2k views

This is very close to what I'm trying to accomplish. How to compile and run kotlin program in command line with external java library I really want to learn how to compile and run simple code that ...
Cody's user avatar
  • 117
2 votes
0 answers
331 views

I am using kotlinx.html DSL to generate an HTML DIV. One of the DIV's attributes is a URL with & in it. e.g. Parameter url below is https://www.example.com?a=1&b=2 fun createDiv(url: String): ...
Big Pumpkin's user avatar
  • 4,595
6 votes
1 answer
4k views

We are making our next project in the company with kotlin multiplatform. Everything worked fine until I tried to create a release version for android to beta test. I got this error in release ...
Hüseyin Bülbül's user avatar
1 vote
1 answer
3k views

Writing chat app using kotlin, historically from nodejs I have websocket json objects in/output format: {"action": "join:chatroom", "payload", "chatroom-name"} {"action": "leave:chatroom", "payload", ...
Roman Vasilyev's user avatar
3 votes
1 answer
2k views

I’m getting a NoClassDefFoundError when trying to invoke the Foo.serializer() method on a @Serializable class. Here's my test case: @Serializable data class Foo(val data: String) val jsonString = ...
rharter's user avatar
  • 2,495