*Here's a joke*: How many engineers does it take t...
# announcements
g
Here's a joke: How many engineers does it take to make ktor/exposed/klaxon work together? None, it seems to be impossible. Strange thing is that I had this working prefectly before I converted Reports from Table to IntIdTable and Report to an IntEntity; I also added releationships/references and primary keys and default values since it last worked. Does anyone see what I am doing wrong here?
Copy code
fun Any.jsonToString(prettyPrint: Boolean): String{
        var thisJsonString = Klaxon().toJsonString(this)
        var result = thisJsonString
        if(prettyPrint) {
            if(thisJsonString.startsWith("[")){
                result = Klaxon().parseJsonArray(thisJsonString.reader()).toJsonString(true)
            } else {
                result = Klaxon().parseJsonObject(thisJsonString.reader()).toJsonString(true)
            }
        }
        return result
    }
routing {
    route("report") {
        route("get") {
            get("all") {
                call.respondText {
                    dbConnect()
                    val reports = transaction { Report.all().toList() }
                    Klaxon().jsonToString(reports)
                }
            }
I think I figured it out... it was working earlier because I was mapping the Table object to a class without inherentance and mostly just string objects before sending to klaxon.