Skip to content

Instantly share code, notes, and snippets.

@rhodri
rhodri / SprayJsonCollections.scala
Created August 5, 2014 14:35
Adapter for ReactiveMongo and spray-json. Includes required Collection and QueryBuilder classes. Derived from https://gist.github.com/nevang/4690568
import scala.util._
import java.nio.ByteBuffer
import org.apache.commons.codec.binary.{Base64, Hex}
import org.jboss.netty.buffer.ChannelBuffers
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{ DateTime, DateTimeZone }
import reactivemongo.api.collections._
@rhodri
rhodri / DateMarshalling.scala
Created August 5, 2014 14:45
spray-json formats for Java Date and XMLGregorianCalendar
import java.text._
import java.util._
import javax.xml.datatype._
object DateMarshalling {
import spray.json._
implicit object GregorianCalendarFormat extends JsonFormat[XMLGregorianCalendar] {
@rhodri
rhodri / UUIDMarshalling.scala
Created August 5, 2014 14:46
spray-json format and spray-httpx FromStringDeserializer for Java UUIDs
import java.util.UUID
import spray.httpx.unmarshalling.{FromStringDeserializer, MalformedContent}
object UUIDMarshalling {
import spray.json._
implicit object UUIDJsonFormat extends JsonFormat[UUID] {