=doc fix spray-json included snippet (#21045)
This commit is contained in:
parent
c0861cb7d5
commit
c520df3210
2 changed files with 6 additions and 6 deletions
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
package docs.http.scaladsl
|
package docs.http.scaladsl
|
||||||
|
|
||||||
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
|
|
||||||
import akka.http.scaladsl.server.Directives
|
|
||||||
import org.scalatest.{ Matchers, WordSpec }
|
import org.scalatest.{ Matchers, WordSpec }
|
||||||
|
|
||||||
class SprayJsonExampleSpec extends WordSpec with Matchers {
|
class SprayJsonExampleSpec extends WordSpec with Matchers {
|
||||||
|
|
@ -13,7 +11,9 @@ class SprayJsonExampleSpec extends WordSpec with Matchers {
|
||||||
def compileOnlySpec(body: => Unit) = ()
|
def compileOnlySpec(body: => Unit) = ()
|
||||||
|
|
||||||
"spray-json example" in compileOnlySpec {
|
"spray-json example" in compileOnlySpec {
|
||||||
//#example
|
//#minimal-spray-json-example
|
||||||
|
import akka.http.scaladsl.server.Directives
|
||||||
|
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
|
||||||
import spray.json._
|
import spray.json._
|
||||||
|
|
||||||
// domain model
|
// domain model
|
||||||
|
|
@ -120,4 +120,4 @@ class SprayJsonExampleSpec extends WordSpec with Matchers {
|
||||||
}
|
}
|
||||||
//#second-spray-json-example
|
//#second-spray-json-example
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ This is how you enable automatic support for (un)marshalling from and to JSON wi
|
||||||
|
|
||||||
Once you have done this (un)marshalling between JSON and your type ``T`` should work nicely and transparently.
|
Once you have done this (un)marshalling between JSON and your type ``T`` should work nicely and transparently.
|
||||||
|
|
||||||
.. includecode:: ../../code/docs/http/scaladsl/SprayJsonExampleSpec.scala
|
.. includecode2:: ../../code/docs/http/scaladsl/SprayJsonExampleSpec.scala
|
||||||
:include: example
|
:snippet: minimal-spray-json-example
|
||||||
|
|
||||||
4. By default, spray-json marshals your types to pretty printed json by implicit conversion using PrettyPrinter, as defined in
|
4. By default, spray-json marshals your types to pretty printed json by implicit conversion using PrettyPrinter, as defined in
|
||||||
``implicit def sprayJsonMarshallerConverter[T](writer: RootJsonWriter[T])(implicit printer: JsonPrinter = PrettyPrinter): ToEntityMarshaller[T]``.
|
``implicit def sprayJsonMarshallerConverter[T](writer: RootJsonWriter[T])(implicit printer: JsonPrinter = PrettyPrinter): ToEntityMarshaller[T]``.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue