diff options
-rw-r--r-- | src/main/scala/spray/json/ProductFormats.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/scala/spray/json/ProductFormats.scala b/src/main/scala/spray/json/ProductFormats.scala index 5504fbd..b920d0a 100644 --- a/src/main/scala/spray/json/ProductFormats.scala +++ b/src/main/scala/spray/json/ProductFormats.scala @@ -23,6 +23,14 @@ package spray.json trait ProductFormats { this: StandardFormats => + def jsonFormat0[T <: Product :ClassManifest](construct: () => T): RootJsonFormat[T] = { + jsonFormat(construct) + } + def jsonFormat[T <: Product](construct: () => T): RootJsonFormat[T] = new RootJsonFormat[T]{ + def write(p: T) = JsObject() + def read(value: JsValue) = construct() + } + def jsonFormat1[A :JF, T <: Product :ClassManifest](construct: A => T): RootJsonFormat[T] = { val Array(a) = extractFieldNames(classManifest[T]) jsonFormat(construct, a) |