Reputation: 3812
I have the following:
def response() = {
if (value == 1) {
("code" -> "API_001") ~ ("result" -> "OK - Room created")
}
}
JsonResponse(
("response" -> response)
)
But I get the following error:
No implicit view available for Any => net.liftweb.json.package.JValue
Ay help much appreciated, thanks in advance :)
Upvotes: 0
Views: 443
Reputation: 67888
def response()
is of type Any
because your if
clause is (if value != 1
, it needs to return (): Unit
, so the overall type of the expression is a supertype of JValue
and Unit
). You need to add an else
clause which returns an appropriate type.
Upvotes: 4