Hi Andad,

take a look at the example here
<https://github.com/2m/akka-stream-sandbox/blob/c8551eeb5ab6922f51b2114c9efe58b72525844e/src/test/scala/ServerRequestAsJson.scala>.
It demonstrates how to unmarshal request body to a custom case class. That
example uses spray-json. You can also use play-json or json4s with the support
library from here <https://github.com/hseeberger/akka-http-json>.

On Fri, Jun 26, 2015 at 1:11 PM, Anand <[email protected]> wrote:

> Folks,
>
> I am quite a newbie to Scala and Akka-HTTP. I am using 1.0-RC3, and have
> managed to read some examples to get a few things working.
> I tried searching on the forums, but not exactly sure how to do this. So
> apologies, if this is a repeat question - in which case I would really
> appreciate a pointer to the solution
>
> I was able to map the formFields from the request fine. Now I want to
> unmarshal a JSON payload coming as part of the request body.
>
> How to unmarshal an incoming JSON payload into a custom class (and
> optionally, also to a Map?)
>
> Given something like this in my route:
>
> path("path") {
>   post {
>         complete {
>           "Request to get a nested path , object formed is Foo"
>         }
>       }
>
>   }
>
> How and where exactly do to unmarshalling?
>
>
> Thank you in advance!
>
>  --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Martynas Mickevičius
Typesafe <http://typesafe.com/> – Reactive
<http://www.reactivemanifesto.org/> Apps on the JVM

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to