Why doesn't that work you literally can see that I...
# serialization
j
Why doesn't that work you literally can see that I have kotlinx serialization, ktor client and content negotiations:
message has been deleted
Intellij is killing me sometimes in multi module projects
(the variable was just to show that I have kotlinx serialization)
b
Smells like import collision. Try importing that function with import alias
j
the import for this should be
Copy code
import kotlinx.serialization.json.json
right?
if yes intellij can't find this method. this also doesn't work
Copy code
import kotlinx.serialization.json.*
b
No, it should be from ktor content negotiation module
j
okay let me search that
intellij can't find this
Copy code
import io.ktor.serialization.kotlinx.json.json
b
j
I have these modules. As I said I can work with Json normally with Json.decodeFromString etc. and the ktor http client also works fine.
h
With Ktor 2.0 you should use the new package names:
Copy code
val ktor = "2.0.1"
api("io.ktor:ktor-client-core:$ktor")
api("io.ktor:ktor-client-content-negotiation:$ktor")
api("io.ktor:ktor-serialization-kotlinx-json:$ktor")
j
oh ok let me try that
j
works perfectly fine thanks
🎉 1
b
Btw, next time you have a question about ktor, it's best to also specify if you're on 1.x or 2.x version
j
yes ok