Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Kirill Yankov
    you can then get Map[String, JsValue] of the fields of the JsObject
    jsonString.parseJson.asJsObject.fields will return Map[String, JsValue]
    I wanted to understand spray json library.
    Any hints to tell where to start from?
    I meant code.
    Vladislav Rybin
    hey guys, does anyone else have false error highlights in spray routes when using IntelliJ IDEA?
    All my code is covered in red highlighting :^)
    Is there a way to fix this?
    Arnout Engelen
    @VladislavRybin in akka-http you can use concat instead of ~ which might be less prone to confusing IntelliJ - not sure if that was in Spray already though (
    Konrad `ktoso` Malawski
    it wasn't
    please upgrade to akka-http; spray has been end-of-life for years
    the upgrade is rather straight forward
    Guys wanted help regarding this one:
    How to provide default values for optional parameters in request payload while marshalling ?
    @ktoso @jrudolph your help required on the above issue.
    Arnout Engelen
    @shankarshastri this is currently not supported in spray-json, but if it's just a couple of classes you could write your own custom readers? the generated writer might already do what you want?
    @raboof , can you give me a example, or if present in can you suggest me?
    Arnout Engelen
    @shankarshastri if you search for def read in the README those are examples of different ways to 'manually' write readers
    this room still active? :D how do I marshal a case class to json when using akka-http websocket? I am sending json with the akka-http websocket client.
    Arnout Engelen
    @vito-c most people have moved to akka-http and discuss it in akka/akka or I think
    @vito-c for marshalling case classes in akka-http I think both spray-json and play-json are still popular
    I'm not sure about websockets specifically but still might help?
    @raboof how would one marshal to a just a Message? I can do it automatically to a MessageEntity
    could not find implicit value for parameter m: akka.http.scaladsl.marshalling.Marshal
    [error]   val outgoing = Source.fromFuture(Marshal(myMsg).to[Message])
    [error]                                                     ^
    Arnout Engelen
    @vito-c do you mean HttpEntity? It works for those because of the implicit conversion at, you might want to introduce a similar one for Message
    (you're writing a Scala plugin for neovim? that sounds pretty cool)
    Arnout Engelen
    (ah I see you found akka/akka :smile: )
    hi @raboof yah I'm working on a scala based ensime plugin (mostly for fun) :) I'm looking at that SprayJsonSupport for Message now ... do you have an example of a Marshaller for another internal?
    Arnout Engelen
    @vito-c not really... not sure I understand exactly what you need but something like implicit def sprayJsonToWsMessageMarshaller[T](implicit writer: RootJsonWriter[T], printer: JsonPrinter = CompactPrinter): Marshaller[T, Message] = Marshaller.strict(t => Marshalling.Opaque(() => TextMessage(writer.write(t)))) might work?
    Hi. The spray testkit doesn't seem to work with contentType. I have an example here: where if you hit localhost:8080 with either application/json or application/myJson in the running service it returns the correct contentType but testing the route using spray testkit it always returns application/json
    Konrad `ktoso` Malawski
    spray is end of life since many years; please move on to akka-http
    Jason Goodwin

    Hey I know spray is EOL'd but I'm wondering if there would be any concerns w/ setting a request timeout at a per-request level

           httpExtension ! connect
           def receive = {
              case, _) =>
                // The client should then respond with Connected.
                // We take the sender of that Connected response (which is an HttpClientConnection)
                val httpClientConnection = sender()
                sender() ! SetRequestTimeout(timeout.duration)
                sender() ! request
              case res: HttpResponse =>
                // HttpResponse is the expected response from sending the HttpRequest.
              // handle errors

    I feel like this may not work

    because the HttpClientConnection may receive another request in between
    Or that will just ignore pooling and always create additional connections?
    I guess my question is really: how do I set a request timeout per request
    That's what I came up with ^
    Jason Goodwin
    Right I see
    there are host connectors that are created by host, port and config.
    Above is the connection configuration
    Jason Goodwin
    (And there are two APIs - the host level, and connection level, the latter being lower level.)
    Thomas Vogel

    Hi guys! I can't get the JsonFormats for recursive Types section of the compiling. Literally copy pasting

    case class Foo(i: Int, foo: Foo)
    implicit val fooFormat: JsonFormat[Foo] = lazyFormat(jsonFormat(Foo, "i", "foo"))

    leads to

    [error] /Users/thomasvogel/sandbox/scala-sandbox/akka-http-sandbox/src/main/scala/tom/vogel/Example.scala:57:68: forward reference extends over definition of value fooFormat
    [error]     implicit val fooFormat: JsonFormat[Foo] = lazyFormat(jsonFormat(Foo, "i", "foo"))

    Any ideas?

    Andriy Plokhotnyuk
    Does spay supports application/problem+json context Type?
    Vladimir Pavkin
    Hi all!
    Anyone here to help publishing spray-json 1.3.6? :)