From 938576d2859f3749a357c96ac7a9be6c5fd4ec7e Mon Sep 17 00:00:00 2001 From: Mathias Date: Wed, 30 Nov 2011 16:07:43 +0100 Subject: Add RootJsonReader and RootJsonWriter as well as some helper methods, closes #10 --- src/main/scala/cc/spray/json/JsonFormat.scala | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main/scala/cc/spray/json/JsonFormat.scala') diff --git a/src/main/scala/cc/spray/json/JsonFormat.scala b/src/main/scala/cc/spray/json/JsonFormat.scala index 01b9f80..683a823 100644 --- a/src/main/scala/cc/spray/json/JsonFormat.scala +++ b/src/main/scala/cc/spray/json/JsonFormat.scala @@ -52,8 +52,20 @@ object JsonWriter { */ trait JsonFormat[T] extends JsonReader[T] with JsonWriter[T] +/** + * A special JsonReader capable of reading a legal JSON root object, i.e. either a JSON array or a JSON object. + */ +@implicitNotFound(msg = "Cannot find RootJsonReader or RootJsonFormat type class for ${T}") +trait RootJsonReader[T] extends JsonReader[T] + +/** + * A special JsonWriter capable of writing a legal JSON root object, i.e. either a JSON array or a JSON object. + */ +@implicitNotFound(msg = "Cannot find RootJsonWriter or RootJsonFormat type class for ${T}") +trait RootJsonWriter[T] extends JsonWriter[T] + /** * A special JsonFormat signaling that the format produces a legal JSON root object, i.e. either a JSON array * or a JSON object. */ -trait RootJsonFormat[T] extends JsonFormat[T] \ No newline at end of file +trait RootJsonFormat[T] extends JsonFormat[T] with RootJsonReader[T] with RootJsonWriter[T] \ No newline at end of file -- cgit v1.2.3