There is an existing question that has much of what I'm after:
Extracting Raw JSON as String inside a Spray POST route
But it stops short without explaining how to get the actual Json string representation out of the Directive[String]. I'm trying to…
For some reason, my code wont resolve this symbol "respondWithMediaType" despite having all necessary imports. I'm fairly new to both spray and scala - so perhaps missing something obvious?
import spray.http.MediaTypes._
import spray.json._
…
I cloned spray json project, but see that Spray 2.0 branch origin/feature/2.0.0 last commit on November 2012. Does it mean that spray-json 2.0.0 has been stopped? What it status/plans for today?
I want to return list of json objects based on my case class objects.
Following is my spray router, which returns list of 'Appointment' objects.
trait GatewayService extends HttpService with SLF4JLogging {
import…
I try to create simple CRUD application with scala and spray-routing. I have the following route:
override def receive = runRoute {
path("entities" / LongNumber) { id =>
get {
produce(instanceOf[MyEntity]) {
func => ctx…
I have been trying to marshal a bunch of Maps but I get error. Here is the definitions:
import spray.httpx.SprayJsonSupport._
import spray.json.DefaultJsonProtocol._
import scala.collection.JavaConverters._
case class SchemaMap( schemaMap:…
assume I have one base class B and two subclasses S1 and S2.
I want serialize and deserialize class S1 and S2.
Therefore I have two questions:
Is it possible two write a JsonFormat for class B and use it in class S1 and S2 for serialization?
I want…
Ok this is really bugging me.I have implemented a REST api using spray and scala,akka. I have successfully implemented spray get, post routes to query mysql database and give the json output.I am able to send the parameters within the post body but…
I am currently struggling with spray-json writing a protocol for my data model. For deserialization of JSON data to my data transfer objects, a DAO has to be contacted to check if an appropriate object exists, otherwise a DeserializationException…
I'm thinking to replace a field called "type" in a JSON in a POST with somethig like this
def rawJson = extract { _.request.entity.asString}
post {
rawJson { json =>
val new json = println(json.replace("\"type\":",…
I'm receiving the following error message when trying to parse some json:
[info] The future returned an exception of type: spray.httpx.PipelineException, with message:
Vector("eba760a81b177051b0520418b4e10596955adb98196c15367a2467ab66a19b5c",…
I use a spray-json for convert some case class into json, but i have a troubles with convert List to json:
case class Foo(id: Int)
object FooJsonSupport extends DefaultJsonProtocol with SprayJsonSupport {
implicit val fooFormats =…