Skip to content

Commit

Permalink
Added a helpful convertion to JValue
Browse files Browse the repository at this point in the history
  • Loading branch information
dpp committed Mar 18, 2011
1 parent 4f4b10a commit 8b57a82
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -43,6 +43,15 @@ trait RestHelper extends LiftRules.DispatchPF {
(in.weightedAccept.isEmpty && in.path.suffix.equalsIgnoreCase("json")) ||
suplimentalJsonResponse_?(in)
}

/**
* Take any value and convert it into a JValue. Full box if
* it works, empty if it does
*/
protected def anyToJValue(in: Any): Box[JValue] = Helpers.tryo{
implicit def formats = DefaultFormats
Extraction.decompose(in)
}

/**
* If there are additional custom rules (e.g., looking at query parameters)
Expand Down

0 comments on commit 8b57a82

Please sign in to comment.