A suite of scala libraries for building and consuming RESTful web services on top of Akka: lightweight, asynchronous, non-blocking, actor-based, testable
import com.konga.order.models.OrderJsonSupport._
import DefaultJsonProtocol._
RouteTest
in the testkit appears to eagerly create and start the actor system. While this normally wouldn't be an issue, we use ScalaTest's tagging to include/exclude tests. The eager loading slows things down considerably as the actor system will be initialized even though no tests are actually run.
@shankarshastri you can use spray-json.
import spray.json._
val jsonString: String = ???
val json: JsObject = jsonString.parseJson.asJsObject
or you can declare a class describing this json and declare format for it and then convert to it directly:
class JsonRepr(???)
implicit object ReprFormat extends RootJsonFormat[JsonRepr]{
???
}
import spray.json._
val jsonString: String = ???
jsonString.parseJson.convertTo[ReprFormat]
jsonString.parseJson.asJsObject.fields
will return Map[String, JsValue]
concat
instead of ~
which might be less prone to confusing IntelliJ - not sure if that was in Spray already though (https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/index.html)