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
0 answers

Mongo DB DAO and Spray JSON :

My Mongo DB abstract Dao is defined as follows abstract class DbMongoDAO1[K, T <: Keyable[K]] (implicit val manifestT: Manifest[T], val manifestK: Manifest[K]) extends DbDAO[K, T] with DbDAOExtensions[K, T] with MongoConnection2 …
0
votes
1 answer

How to produce the BigDecimal NumberFormatException and resolve it?

I am using the code snip from spray json deserialize in my scala code. https://github.com/spray/spray-json import spray.json._ import DefaultJsonProtocol._ object MyJsonProtocol extends DefaultJsonProtocol { implicit object…
sk1007
  • 571
  • 3
  • 11
  • 30
0
votes
0 answers

akka spray -> akka http migration

this is fragment of my router in spray based service: path(baseUrl / version / "apps" / Segment / "users" / Segment) { (app, user) => respondWithMediaType(MediaTypes.`application/json`) { ctx => createProxy(ctx, management, GetUser(appId =…
HoTicE
  • 573
  • 2
  • 13
0
votes
1 answer

How to make htttp request with akka stream for 10K request

I build server with akka-http and akka-stream but it lost some request in 2K+ request. What I miss something or my understand for akka is wrong. this is my code implicit val actorRef = ActorSystem("system", testConf) implicit val materializer =…
0
votes
1 answer

spray-json in Http().bindAndHandle

I'm currently going through the akka-http documentation & examples. I'm stuck on probably something very trivial: passing in route-configuration with Directives and JsonSupport. I'm following the docs on introduction and json-support For the…
dr jerry
  • 9,768
  • 24
  • 79
  • 122
0
votes
1 answer

Generic JSON Support

How do you use RootJsonFormat with Generics? Do I have to copy paste every possibility like this: trait IDJsonSupport extends SprayJsonSupport with DefaultJsonProtocol{ implicit object AddressIDFormat extends RootJsonFormat[ID[Address]] { …
Etam
  • 4,553
  • 10
  • 40
  • 60
0
votes
1 answer

Akka: How to work with returned Json feed?

I get a Json feed back from a remote third party API in this way: val myjson: Future[HttpResponse] = http.singleRequest(HttpRequest(uri = encodedUri)) myjson onComplete { case Success(response) => sender !…
Randomize
  • 8,651
  • 18
  • 78
  • 133
0
votes
2 answers

Akka: how to create a compact json without empty values?

Is it possible with Akka (maybe some Spray "utils"?) to build a compact json feed starting from a case class like this: case class Stuff (val1: String, val2: String, val3: String) built in this way: Stuff("one value", "", "another value") and get a…
Randomize
  • 8,651
  • 18
  • 78
  • 133
0
votes
1 answer

Spray.io - Removing fields from response

I've built a RESTful API using Spray.io. It contains a number of endpoints, each of which returns JSON. I use the Spray JSON marshaller to marshal my internal objects to JSON which are returned to the user. So I have something similar…
fatlog
  • 1,182
  • 2
  • 14
  • 28
0
votes
0 answers

SprayJson: missing required member during marshalling

I have case class case class CreateOffer(playerId: Option[PlayerId], modifier: Double, expiry: DateTime, start: DateTime, notification: String) When I try in test to Post this in spray val req = Post("/create", createOffer) ~> …
0
votes
2 answers

How to convert nested maps of type Map[String, Map[String, Any]] to JSON in Scala?

I tried converting Map[String, Map[String, Any]] in Scala to JSON but since they have nested maps so unable to do it. Is there a way to do it? I tried looking at this link but it converts everything to string and converts a list as "List(...)". Any…
0
votes
1 answer

Companion objects, implicits, and Json

I am having trouble adding an implicitly defined type converter for a type for which I also have a Json format. I doubt if the problem has anything to do with Json (or Spray). Or MyDate for that matter. Here's a fragment of code which leads to the…
Phasmid
  • 923
  • 7
  • 19
0
votes
1 answer

Why does my route not recognize my protocol

I've noticed while trying to write a jsonProtocol for my case classes that I get errors with nested case classes. Whereas, if I decouple the case classes and just create one giant case class, with all the fields, it will work fine. case class…
0
votes
1 answer

JsValue serialization fail

In my app I'm using https://github.com/fommil/spray-json-shapeless library for serializaion, but I have problem with this class: case class FooResult(var id: Option[String], jobId: String, completedAt: DateTime, result: JsValue) extends…
mgosk
  • 1,874
  • 14
  • 23
0
votes
0 answers

Akka-Http Json Marshalling and Support Issue

Since I'm new to Akka-HTTP, I tried to implement JSON in Akka-HTTP using Marshalling and get POST data from client. But the code is generating error: The request content was malformed: Unexpected end-of-input at input index 0 (line 1, position 1),…
Sujit Baniya
  • 895
  • 9
  • 27