Tôi đang sử dụng spray-json để sắp xếp các danh sách các đối tượng tùy chỉnh vào JSON. Tôi có lớp vỏ sau và JsonProtocol của nó.spray-json và danh sách marshalling
case class ElementResponse(name: String, symbol: String, code: String, pkwiu: String, remarks: String, priceNetto: BigDecimal, priceBrutto: BigDecimal, vat: Int, minInStock:Int, maxInStock: Int)
object JollyJsonProtocol extends DefaultJsonProtocol with SprayJsonSupport {
implicit val elementFormat = jsonFormat10(ElementResponse)
}
Khi tôi cố gắng để đưa vào trong một con đường như thế này:
get {
complete {
List(new ElementResponse(...), new ElementResponse(...))
}
}
tôi nhận được một lỗi nói rằng:
could not find implicit value for evidence parameter of type spray.httpx.marshalling.Marshaller[List[pl.ftang.scala.polka.rest.ElementResponse]]
Có lẽ bạn biết vấn đề là gì?
Tôi đang sử dụng Scala 2.10.1 với phun 1,1-M7 và phun json 1.2.5
Xem [ví dụ này] (https://github.com/spray/spray/blob/master/examples/spray-client/simple-spray-client/src/main/scala/spray/examples/Main.scala), sử dụng '' 'List'''. – opyate