Questions tagged [spray-json]

Relates to the spray-json Scala library.

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

339 questions
0
votes
3 answers

Difficulty serializing immutable.Map with spray-json

Apologies in advance for cross-posting: I submitted this question to the spray user list, but the list appears to be moderated, and nobody seems to be home. Hopefully SO is a better venue. I am having difficulty serializing complex data structures…
Dan Barowy
  • 2,270
  • 24
  • 35
0
votes
2 answers

(Un)marshall JSON with named root for Ember Data using Scala case class on Spray

I am writing a RESTful interface and I would like to marshall and unmarshall JSON ready for Ember Data. The wrinkle is that Ember Data wants the entity name and the two libraries I've tried, spray-json and json4s, don't appear to do this…
Sarge
  • 2,367
  • 2
  • 23
  • 36
0
votes
1 answer

How to implement a generic REST api for tables in Play2 with squeryl and spray-json

I'm trying to implement a controller in Play2 which exposes a simple REST-style api for my db-tables. I'm using squeryl for database access and spray-json for converting objects to/from json My idea is to have a single generic controller to do all…
Geir
  • 514
  • 4
  • 18
0
votes
2 answers

Post request in spray. How to capture it at server side?

I need to make a post request with Spray but i don't understand how to capture the request at server side. This is my code: CLIENT: . . val pipeline: HttpRequest => Future[HttpResponse] = sendReceive val fileName = "document.docx" val path =…
YoBre
  • 2,520
  • 5
  • 27
  • 37
0
votes
1 answer

Serializing Templated Container Types

I've been struggling with this for a few hours. I'm hoping someone could assist me in understanding where the problem is. Spray-JSON has a test case…
Rasputin Jones
  • 1,427
  • 2
  • 16
  • 24
-1
votes
2 answers

How can I convert inbound empty optional array fields to None with spray-json?

The site I'm working with returns empty arrays for optional fields that have no values. i.e. given these definitions - case class Sample(f1: Option[Seq[F1]], id: Option[Int]) implicit val formatF1 = jsonFormat4(F1) implicit val formatSample =…
trabant
  • 11
  • 1
-1
votes
1 answer

How to make Spray Json throw exception when it sees extra fields?

For example suppose I have case class Test(a: String, b: String) ... implicit val testFormat = jsonFormat2(Test.apply) and a json with an extra c field: val test = "{\"a\": \"A\", \"b\": \"B\", \"c\": \"C\"}" then I want to find a way…
samthebest
  • 30,803
  • 25
  • 102
  • 142
-2
votes
3 answers

Passing values with appropriate types

I am new to scala. I have one parameter which can be either string, boolean or number. I don't know before which data type will come. Earlier for number I had following code. Try { JsNumber(parameter._x.trim()) } match { case…
user14190485
-3
votes
1 answer

Getting data from json array in scala

I have newly started working on scala. I have following json array: [ { "id": "1", "formatType": "text", "value": "bgyufcie huis huids hufhsduhfsl hd" }, { "id": "2", "formatType": "text size", "value": 12 }, { …
user14031522
1 2 3
22
23