Koert,
yes, spray-json 1.3.0 does introduce some breaking changes, which cause it to be incompatible with the current spray releases.
Here is the ticket to follow:
https://github.com/spray/spray/issues/932
However, you can already use spray-json 1.3.0 with the existing spray releases simply by not using the pre-defined `SprayJsonSupport` but a verbatim copy thereof.
So this does it:
trait SprayJsonSupport {
implicit def sprayJsonUnmarshallerConverter[T](reader: RootJsonReader[T]) =
sprayJsonUnmarshaller(reader)
implicit def sprayJsonUnmarshaller[T: RootJsonReader] =
Unmarshaller[T](MediaTypes.`application/json`) {
case x: HttpEntity.NonEmpty ⇒
val json = JsonParser(x.asString(defaultCharset = HttpCharsets.`UTF-8`))
jsonReader[T].read(json)
}
implicit def sprayJsonMarshallerConverter[T](writer: RootJsonWriter[T])(implicit printer: JsonPrinter = PrettyPrinter) =
sprayJsonMarshaller[T](writer, printer)
implicit def sprayJsonMarshaller[T](implicit writer: RootJsonWriter[T], printer: JsonPrinter = PrettyPrinter) =
Marshaller.delegate[T, String](ContentTypes.`application/json`) { value ⇒
val json = writer.write(value)
printer(json)
}
}
object SprayJsonSupport extends SprayJsonSupport
In case you wonder why the exact same code works when you compile it but fails as a part of spray 1.x.1:
The breaking change here is source compatible but not binary compatible. So simply recompiling against spray-json 1.3.0 is all that is required.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/spray-user/CANx3uAjQ02bOUQ06Ou0jr%3DXAMf52za_k5bUGsu-wP7e6BSp20A%40mail.gmail.com.