spray-json Questions

4

Solved

i'm got an error: spray.json.ProductFormats$class.productElement2Field NullPointerException Here is my code for json deserialisation: object DomainJsonProtocol extends DefaultJsonProtocol { im...
Insolate asked 9/2, 2014 at 18:29

2

I have a User model case class User(name: String, email: String, password: Option[String] = None, key: Option[UUID] = None) With a spray-json marshaller object UserJsonSupport extends DefaultJs...
Doubletime asked 14/7, 2015 at 12:38

3

Solved

How to deserialize nested objects correctly in spray-json? import spray.json._ case class Person(name: String) case class Color(n: String, r: Int, g: Int, b: Int, p: Person) object MyJsonPr...
Ungual asked 11/2, 2014 at 1:50

3

I'm working with a legacy HTTP API (that I can't change) that responds with JSON in the body, but gives a Content-Type: text/plain; charset=utf-8 header. I am attempting to unmarshall that HTTP bo...
Suckling asked 16/12, 2015 at 18:34

3

Solved

I am trying to return a List from my complete directive in spray-routing. complete { List("hello") } However, I am getting an error - Expression of type List[String] doesn't conform to expecte...
Twopiece asked 18/2, 2015 at 2:43

3

Solved

In some cases default values make more sense than optionals in case classes: case class Car(numberOfWheels:Int = 4, color:String) case class Car(numbeOfWheels:Option[Int], color:String) //silly ...
Buatti asked 1/4, 2013 at 9:32

2

Solved

I understand that if I have: case class Person(name: String) I can use object PersonJsonImplicits extends DefaultJsonProtocol { implicit val impPerson = jsonFormat1(Person) } and thus seria...
Colligan asked 6/1, 2014 at 9:24

6

Solved

I have an optional field on my requests: case class SearchRequest(url: String, nextAt: Option[Date]) My protocol is: object SearchRequestJsonProtocol extends DefaultJsonProtocol { implicit val...
Zionism asked 30/5, 2012 at 15:23

3

Solved

I have a case class containing varargs, with an implicit jsonFormat as follows: import spray.json._ case class Colors(name: String*) object MyJsonProtocol extends DefaultJsonProtocol { implicit v...
Greaseball asked 29/1, 2015 at 10:16

2

Solved

I am facing an issue with Companion Objects picking up its type instead of the case class I am using spray json serdes. They need an implicit JsonFormat. This format is obtained by calling a func...
Cosy asked 2/3, 2018 at 17:0

2

Solved

I have such model: two enumerations and one case class with two fields of these enums types: // see later, why objects are implicit implicit object Fruits extends Enumeration { val Apple = Value(...
Refusal asked 6/10, 2017 at 18:52

3

I am using json-spray. It seems that when I attempt to print a parsed JsString value, it includes book-ended quotes on the string. val x1 = """ {"key1": "value1", "key2": 4} """ println(x1.asJson)...
Wavellite asked 6/12, 2013 at 15:26

1

Solved

I am trying to write a test for a Post request here is my code : val request = CreateLinkRequest(token = Some(validToken),billing_ref_id = Some("123"), store_id = Some("123"), agent_id = Some("12...
Octavie asked 12/12, 2016 at 1:36

3

Solved

I'm trying to reprocude this or this, but I keep getting an error I am not able to fix... First of all, here are my dependencies: compile 'io.spray:spray-can_2.11:1.3.1' compile 'io.spray:spray-rou...
Hippomenes asked 11/7, 2014 at 19:3

2

Solved

I'm creating custom json readers for case classes but it can't find implicit JsonReader type class for List[T] which is used in other case class. When I checked DefaultJsonProtocol, it has implici...
Kanpur asked 25/5, 2016 at 3:56

2

Solved

I'm trying (and failing) to get my head around how spray-json converts json feeds into objects. If I have a simple key -> value json feed then it seems to work ok but the data I want to read comes ...
Outherod asked 15/2, 2015 at 19:8

2

Solved

Not sure this is a bug, but the following demo fails on the final cases: import spray.json._ import DefaultJsonProtocol._ object SprayTest { 1.toJson "".toJson (Left(1): Either[Int, String]).t...
Dominickdominie asked 2/4, 2016 at 20:15

3

Solved

spray-json relies on the presence of an in-scope, implicit JsonWriter[T] when calling toJson on an instance of T. Say I have a trait with several concrete subtypes, each of which has a JsonWriter...
Cyclone asked 8/3, 2016 at 18:21

2

I've a problem about unmarshalling objects to Json via using spray - akka. When i'd like to use actors that returns Future[List[Person]] , it doesn't work. If i use dao object directly, it works....
Lubow asked 22/11, 2015 at 19:21

1

Solved

I'm using spray-json to serialize an object tree, which is based on a class hierarchy such as this: trait Base { val _id: Long } case class Person(_id: Long, firstName: String, lastName: String)...
Apron asked 20/11, 2014 at 20:6

1

Solved

I have a very simple question. This is not only true with spray-json but I have read similar claims with argonaut and circe. So please enlighten me. In spray-json, I have come across the statement ...
Dunson asked 7/11, 2015 at 6:6

1

Solved

I have this two erros: Error:(39, 20) Cannot find an implicit ExecutionContext. You might pass an (implicit ec: ExecutionContext) parameter to your method or import scala.concurrent.ExecutionConte...
Puerperal asked 23/10, 2015 at 13:52

1

Solved

I have the following code which uses spray-json to deserialise some JSON into a case class, via the parseJson method. Depending on where the implicit JsonFormat[MyCaseClass] is defined (in-line o...
Brassiere asked 7/9, 2015 at 12:26

2

Solved

I'm finding myself in a situation in which I need to serialize into JSON a non case class. Having a class as: class MyClass(val name: String) { def SaySomething() : String = { return "Saying so...
Darill asked 28/10, 2014 at 17:0

3

Solved

I'm using spray-json to marshal lists of custom objects into JSON. I have the following case class and its JsonProtocol. case class ElementResponse(name: String, symbol: String, code: String, pkwi...
Rackrent asked 18/7, 2013 at 21:42

© 2022 - 2024 — McMap. All rights reserved.