Hi,
So I'm a new to Play (using 2.1.1) and Scala and I'm a bit confused by the some of the JSON APIs.
For example, I can do this to create a JsObject:
val person: JsObject = Json.obj(
"user" -> "Max",
"friend" -> "bob")
and I can do this to create a JsValue
val json: JsValue = Json.parse("""
{
"name" : "toto",
"friend": "dorthy"
}
""")
both give me similar JSON objects: {"user":"Max","friend":"bob"} and {"name":"toto","friend":"dorthy"} respectively
But when I try doing something like this to create a JsObject from a JsValue
val person: JsObject = Json.obj( json)
I get a compilation exception: type mismatch; found : play.api.libs.json.JsValue required: (String, play.api.libs.json.Json.JsValueWrapper)
JsValueWrapper??? What is that? It doesn't even up when I search for it in the play api docs.
Can someone please point me in the right direction with regards to differentiating JsValue,JsObject and JsValueWrapper
-Max