how to send and receive json with ktor?
# ktor
c
how to send and receive json with ktor?
a
Have you tried reading the docs?
c
it is client only
no server side example
c
thanks. Currently I use the following code to parse json but it is not official.
Copy code
get("/key/public") {
				val publicKey = PublicKeyJSON(PeerServer.app.crypto.publicKey.encoded.toHexString())
				call.respond(publicKey)
			}
			post("/key/public") {
				val publicKey = call.receive<PublicKeyJSON>()
				call.respond({})
			}
c
Official docs for server JSON are here. You may also be looking for Type-safe Routing