Skip to content

Instantly share code, notes, and snippets.

@regiskuckaertz
Created July 3, 2018 11:21
Show Gist options
  • Save regiskuckaertz/0d6591320c1a8d26e983918022d5e9e3 to your computer and use it in GitHub Desktop.
Save regiskuckaertz/0d6591320c1a8d26e983918022d5e9e3 to your computer and use it in GitHub Desktop.
Scanamo format for streamlining JSON values to strings
object PlayJsonDynamoFormat {
implicit val format: DynamoFormat[JsValue] = DynamoFormat.xmap[JsValue, String](
x => Try(Json.parse(x)) match {
case Success(y) => Right(y)
case Failure(f) => Left(TypeCoercionError(t))
}
)(Json.stringify(_))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment