I started trying Scala and Play to parse through Json data, and was following the tutorial at https://www.playframework.com/documentation/2.3.9/ScalaJson. Now, when I try to run the sample code given there which is:
val json: JsValue = Json.parse("""{
"name" : "Watership Down",
"location" : {
"lat" : 51.235685,
"long" : -1.309197
},
"residents" : [ {
"name" : "Fiver",
"age" : 4,
"role" : null
}, {
"name" : "Bigwig",
"age" : 6,
"role" : "Owsla"
} ]
}
""")
val lat = json \ "location" \ "lat"
I get the following error:
java.lang.NoSuchMethodError: play.api.libs.json.JsValue.$bslash(Ljava/lang/String;)Lplay/api/libs/json/JsValue;
What am I doing wrong? I'm using Scala 2.10 and Play 2.3.9.
Thanks.
JsLookupResult
is new in 2.4. Are you sure you're using 2.1? – Tica