get("/userlist"){
val user_list = hashMapOf<String,Any>()
transaction {
val user_r = Users.selectAll().orderBy(Users.userid, false).limit(5)
for(u in user_r){
user_list.put("userid",u[Users.userid]).toString()
user_list.put("username",u[Users.username]).toString()
user_list.put("password",u[Users.password]).toString()
}
}
call.respond(FreeMarkerContent("users.ftl",user_list,"e"))
}
You are creating a map which holds 1 value for each key. I think what you want is a list of map mutableListOf<Map<String, Any>>
and then transform your Entities to map.