I am developing a Web API using Scala with Scalatra and JOOQ. I would like to deal with Maps instead of Records, Case Classes etc
Using JacksonJsonSupport to automatically serialize my data to JSON :
get("/test") {
val r = DBManager.query select(MODULE.ID, MODULO.NAME) from MODULE fetchArrays
Map("result" -> r)
}
hitting 0.0.0.0:8080/test produces the following output:
{"result":[[1,"VelanRT"],[2,"GeobodyMorphologicalConvolution"], [3,"Sismofacies"]}
but, if using fetchMaps
instead of fetchArrays
:
{"result":[{},{},{}]}
what I expected is a Map[String, AnyVal]
, with the column name as the key and the value being the DB tuple value
Is there any additional setup I need to do? I there a chance that the json serialization from JacksonSupport
is messing with things?