I'm using spray and I need to return a json
object through a method.
val route =
path("all-modules") {
get {
respondWithMediaType(`text/html`) {
complete( configViewer.findAllModules.toString)
}
}
}
This prints ConfigResults(S1000,Success,List(testDataTypes, mandate, sdp))
But I need get this as the json
object. how can I do it?
I tried in this way
val route =
path("all-modules") {
get {
respondWithMediaType(`application/json`) {
complete{
configViewer.findAllModules
}
}
}
}
It gives an compilation error could not find implicit value for parameter marshaller: spray.httpx.marshalling.ToResponseMarshaller