Skip to content

Instantly share code, notes, and snippets.

@chadselph
chadselph / JacksonJsonSupport.scala
Created November 19, 2014 02:30
Spray JSON Support with Jackson
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
import spray.http.{ContentTypes, HttpCharsets, HttpEntity, MediaTypes}
import spray.httpx.marshalling.Marshaller
import spray.httpx.unmarshalling.Unmarshaller
/**
* Use Jackson directly to avoid json4s's dependencies
*/
@ScalaWilliam
ScalaWilliam / WSWithoutPlayApp.scala
Last active June 1, 2017 16:16
Running Play WS standalone, without a Play App. Works with Maven builds nicely. The top way to make REST calls in Scala, in my opinion.
package com.scalawilliam.example.play
import play.api.libs.ws._
/**
* Play's Scala WS library is very very cool. Provides you with plenty niceties.
* See more: https://www.playframework.com/documentation/2.3.x/ScalaWS
*
* Unfortunately it by default requires a Play application context.
* But you do not necessarily always want that.