I have two JsValue created from case class, i.e. Book and Book detail
val bookJson = Json.tojson(Book)
val bookDetailJson = Json.tojson(BookDetail)
JsObject is subtype of JsValue.
JsValue can be simple converted to the JsObject using as or asOpt methods from JsValue. Example:
val someJsValue = ....
val asObject:JsObject = someJsValue.as[JsObject]
val asObjectMaybe:Option[JsObject] = v.asOpt[JsObject]
In the case of JsArray you can not use above code. If you use play and parse JSON with array, then Json.toJson(...) produces JsValue which is JsArray actually. You need to convert JsArray as following:
val someJsValueButArray = ....
val asJsArray:JsArray = Json.toJson(someJsValueButArray).as[JsArray]
val asSeqOfJsObjects:Seq[JsObject] = asJsArray.value.map(_.as[JsObject])