diff options
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/spray/json/CollectionFormats.scala | 6 | ||||
-rw-r--r-- | src/main/scala/spray/json/ProductFormats.scala | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/scala/spray/json/CollectionFormats.scala b/src/main/scala/spray/json/CollectionFormats.scala index 24ab1dd..9a3e8fd 100644 --- a/src/main/scala/spray/json/CollectionFormats.scala +++ b/src/main/scala/spray/json/CollectionFormats.scala @@ -17,6 +17,8 @@ package spray.json +import scala.reflect.ClassTag + trait CollectionFormats { /** @@ -33,7 +35,7 @@ trait CollectionFormats { /** * Supplies the JsonFormat for Arrays. */ - implicit def arrayFormat[T :JsonFormat :ClassManifest] = new RootJsonFormat[Array[T]] { + implicit def arrayFormat[T :JsonFormat :ClassTag] = new RootJsonFormat[Array[T]] { def write(array: Array[T]) = JsArray(array.map(_.toJson).toVector) def read(value: JsValue) = value match { case JsArray(elements) => elements.map(_.convertTo[T]).toArray[T] @@ -90,4 +92,4 @@ trait CollectionFormats { case x => deserializationError("Expected Collection as JsArray, but got " + x) } } -}
\ No newline at end of file +} diff --git a/src/main/scala/spray/json/ProductFormats.scala b/src/main/scala/spray/json/ProductFormats.scala index 7d6c63e..81a48af 100644 --- a/src/main/scala/spray/json/ProductFormats.scala +++ b/src/main/scala/spray/json/ProductFormats.scala @@ -19,6 +19,7 @@ package spray.json import java.lang.reflect.Modifier import scala.annotation.tailrec import scala.util.control.NonFatal +import scala.reflect.ClassTag /** * Provides the helpers for constructing custom JsonFormat implementations for types implementing the Product trait @@ -64,8 +65,8 @@ trait ProductFormats extends ProductFormatsInstances { case _ => deserializationError("Object expected in field '" + fieldName + "'", fieldNames = fieldName :: Nil) } - protected def extractFieldNames(classManifest: ClassManifest[_]): Array[String] = { - val clazz = classManifest.erasure + protected def extractFieldNames(tag: ClassTag[_]): Array[String] = { + val clazz = tag.runtimeClass try { // copy methods have the form copy$default$N(), we need to sort them in order, but must account for the fact // that lexical sorting of ...8(), ...9(), ...10() is not correct, so we extract N and sort by N.toInt |