I am trying to create the REST service using akka Http and slick . I am 
trying to persist the Raw json in the MySql table in string format or BLOB 
format whichever can solve my problem.
The point where I am facing issues is Every time I try to store the Json 
via akka http routes , It throws an error about json being malformed.

object Models {
  case class Customer(name: String,jsonData:String)
  object ServiceJsonProtoocol extends DefaultJsonProtocol {
    implicit val customerProtocol = jsonFormat2(Customer)
  }
}

object AkkaJsonParsing {



  def main(args: Array[String]) {

    implicit val actorSystem = ActorSystem("rest-api")

    implicit val actorMaterializer = ActorMaterializer()

    val list = new ConcurrentLinkedDeque[Customer]()

    import ServiceJsonProtoocol.customerProtocol
    val route =
      path("customer") {
        post {
          entity(as[Customer]) {
            customer => complete {
              list.add(customer)
              s"got customer json ${customer.jsonData}"
            }
          }
        }





Json 
{
    "name":"test",
   "json":[{"type":"alpha","gross":"alpha"}]

}



Error :Request was rejected with rejection 
MalformedRequestContentRejection(Expected String as JsString, but got 
[{"type":"alpha","gross":"alpha"}],None)


I tried changing case class jsonData datatype to Byte,Array[Byte] but 
nothing helps. 
what is the right way to persist whole json?

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to