Ktor - How to enable kotlinx.serialization DSL?


I’m browsing Ktor related resources and came across Ktor 1.3 release notes. There I found this:

Ktor now supports a way to construct a JSON body using the kotlinx.serialization DSL:

client.post("http://localhost:9090") {
body = json {
"key1" to 123
"map" to json {
"key2" to "abc"

To use it on a client, install JsonFeature and add the ktor-client-serialization dependency.

When I paste this into the editor json function is not recognised. How do I enable the kotlinx.serialization DSL? Also the post function complains about missing the type parameter.

If I stick Unit as a type parameter and use a JsonObject as body instead everything works fine. But I would like to use the DSL if possible.