summaryrefslogtreecommitdiff
path: root/src/main/scala/cc/spray/json/StandardFormats.scala
diff options
context:
space:
mode:
authorMathias <mathias@spray.cc>2011-05-24 23:02:25 +0200
committerMathias <mathias@spray.cc>2011-05-24 23:02:25 +0200
commit57bc594e1daa7dff6013759d6fc65f183118aa33 (patch)
treef8ad4c437284fb0583a556a98aba74126a988ea3 /src/main/scala/cc/spray/json/StandardFormats.scala
parent854700927ca944d684c9e0758b5a52da4dde2609 (diff)
downloadspray-json-57bc594e1daa7dff6013759d6fc65f183118aa33.tar.gz
spray-json-57bc594e1daa7dff6013759d6fc65f183118aa33.tar.bz2
spray-json-57bc594e1daa7dff6013759d6fc65f183118aa33.zip
Add JsonFormat for JsValues, some more helpers
Diffstat (limited to 'src/main/scala/cc/spray/json/StandardFormats.scala')
-rw-r--r--src/main/scala/cc/spray/json/StandardFormats.scala11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/main/scala/cc/spray/json/StandardFormats.scala b/src/main/scala/cc/spray/json/StandardFormats.scala
index 20012b4..8b0dc3a 100644
--- a/src/main/scala/cc/spray/json/StandardFormats.scala
+++ b/src/main/scala/cc/spray/json/StandardFormats.scala
@@ -23,19 +23,10 @@ import scala.{Left, Right}
* Provides the JsonFormats for the non-collection standard types.
*/
trait StandardFormats {
+ this: AdditionalFormats =>
private type JF[T] = JsonFormat[T] // simple alias for reduced verbosity
- def safeReader[A :JsonFormat] = new JsonReader[Either[Exception, A]] {
- def read(json: JsValue) = {
- try {
- Right(json.fromJson)
- } catch {
- case e: Exception => Left(e)
- }
- }
- }
-
implicit def optionFormat[T :JF] = new JF[Option[T]] {
def write(option: Option[T]) = option match {
case Some(x) => x.toJson