Marshalling Directives

Marshalling directives work in conjunction with akka.http.scaladsl.marshalling and akka.http.scaladsl.unmarshalling to convert a request entity to a specific type or a type to a response.

See marshalling and unmarshalling for specific serialization (also known as pickling) guidance.

Marshalling directives usually rely on an in-scope implicit marshaller to handle conversion.

Understanding Specific Marshalling Directives

directive behavior
completeWith Uses a marshaller for a given type to produce a completion function for an inner route. Used in conjunction with instanceOf to format responses.
entity Unmarshalls the request entity to the given type and passes it to its inner route. Used in conjunction with as to convert requests to objects.
handleWith Completes a request with a given function, using an in-scope unmarshaller for an input and in-scope marshaller for the output.
Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.