summaryrefslogtreecommitdiff
path: root/src/main/scala/cc/spray/json/JsonFormat.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/cc/spray/json/JsonFormat.scala')
-rw-r--r--src/main/scala/cc/spray/json/JsonFormat.scala14
1 files changed, 13 insertions, 1 deletions
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
@@ -53,7 +53,19 @@ 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