我正在使用喷雾,我需要json
通过方法返回一个对象。
val route =
path("all-modules") {
get {
respondWithMediaType(`text/html`) {
complete( configViewer.findAllModules.toString)
}
}
}
这打印ConfigResults(S1000,Success,List(testDataTypes, mandate, sdp))
但我需要把它作为json
对象。我该怎么做?
我试过这样
val route =
path("all-modules") {
get {
respondWithMediaType(`application/json`) {
complete{
configViewer.findAllModules
}
}
}
}
它给出了编译错误could not find implicit value for parameter marshaller: spray.httpx.marshalling.ToResponseMarshaller