Questions tagged [spray-json]

Relates to the spray-json Scala library.

spray-json is a lightweight, clean and simple implementation in .

327 questions
0
votes
2 answers

Extract Json from Spray POST as string, not by marshaling to entity

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…
Richard Walker
  • 157
  • 2
  • 10
0
votes
1 answer

Can't resolve symbol respondWithMediaType - Scala/Spray/Json

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._ …
0
votes
1 answer

What is a current status of spray-json version 2.0?

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?
Cherry
  • 25,428
  • 40
  • 160
  • 286
0
votes
2 answers

Marshalling list of case class objects

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…
eranga
  • 487
  • 5
  • 14
0
votes
1 answer

Produce an error with scala and spray

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…
pkozlov
  • 687
  • 5
  • 17
0
votes
1 answer

Marshalling of `Map`s with Spray

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:…
Daniel
  • 5,111
  • 6
  • 35
  • 69
0
votes
1 answer

Serialization and Deserialization of Subclasses with spray-json

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…
hami
  • 423
  • 5
  • 13
0
votes
0 answers

sending parameters as JSON in POST body using spray

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…
PRE
  • 13
  • 6
0
votes
1 answer

Some(null) spray json deserialization error

I'm getting a http response with the following json object { transaction_hash: "fbb36255453bf8ff465d9ca5c427bd0e36cc799fda090cbcd62113f1f3e97cb4", output_index: 0, value: 2000000, asset_id: null, asset_quantity: null, addresses:…
Chris Stewart
  • 1,554
  • 1
  • 27
  • 58
0
votes
1 answer

Spray JSON: How to get implicitly declared objects into read and write methods?

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…
rabejens
  • 6,290
  • 8
  • 35
  • 77
0
votes
1 answer

Change a body Field name in a Post in Spray

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\":",…
JoseM LM
  • 333
  • 1
  • 7
0
votes
1 answer

How to convert xml array to json data in scala

I have the xml data in an array as below, i.e, each line corresponds to a single element in array Gambardella, Matthew XML Developer's Guide
Vijay Innamuri
  • 3,912
  • 5
  • 37
  • 65
0
votes
1 answer

Cryptic Spray Json error message

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",…
Chris Stewart
  • 1,554
  • 1
  • 27
  • 58
0
votes
2 answers

ClassNotFoundException: spray.json.JsonFormat

I'm trying to use spray-json. The following test code throws ClassNotFoundException: spray.json.JsonFormat: import spray.json._ import DefaultJsonProtocol._ object App { def main(args: Array[String]) = { val ast = List(1, 2, 3).toJson …
Antoine
  • 1,601
  • 14
  • 27
0
votes
0 answers

Why does Spray error "could not find implicit value for parameter marshaller"?

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 =…
lito
  • 969
  • 8
  • 19
1 2 3
21
22