HTTP: Document how a type is marshalled into json #20514

This commit is contained in:
Ashu Gupta 2016-05-18 22:09:10 +05:30 committed by Johan Andrén
parent f974ae984d
commit e2c1638171
2 changed files with 48 additions and 0 deletions

View file

@ -36,6 +36,13 @@ Once you have done this (un)marshalling between JSON and your type ``T`` should
.. includecode:: ../../code/docs/http/scaladsl/SprayJsonExampleSpec.scala
:include: example
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]``.
Alternately to marshal your types to compact printed json, bring a ``CompactPrinter`` in scope to perform implicit conversion.
.. includecode:: ../../code/docs/http/scaladsl/SprayJsonCompactMarshalSpec.scala
:include: example
To learn more about how spray-json works please refer to its `documentation <https://github.com/spray/spray-json>`_.