package com.github.inikolaev.vertx.web.kotlin

import io.vertx.core.http.HttpServerResponse
import io.vertx.core.json.JsonArray
import io.vertx.core.json.JsonObject

fun HttpServerResponse.endJson(json: JsonObject) = this.end(json.encode())
fun HttpServerResponse.endJson(json: JsonArray) = this.end(json.encode())

package com.github.inikolaev.vertx.web.kotlin

import io.vertx.core.http.HttpServerResponse
import io.vertx.core.json.Json
import io.vertx.core.json.JsonArray
import io.vertx.core.json.JsonObject

fun HttpServerResponse.endJson(json: JsonObject) = this.end(json.encode())
fun HttpServerResponse.endJson(json: JsonArray) = this.end(json.encode())
fun HttpServerResponse.endJson(entity: Any) = this.end(Json.encode(entity))

Make endJson to encode any object to JSON
Make endJson to encode any object to JSON

inikolaev/vertx-web-kotlin