You can use: Box.asA[Map[String, _]](in) which will return Full(in) if in is a Map[String, _] or Empty if it's not. This helps in for comprehensions.
On Wed, Jul 15, 2009 at 12:00 PM, Jeppe Nejsum Madsen <[email protected]>wrote: > > On Wed, Jul 15, 2009 at 11:27 AM, fbettag<[email protected]> wrote: > > > > Any variation i try gives me: > > > > (key, value) <- res > > value filter is not a member of Any > > Ahh yes, JSONParser.parse returns Box[Any] since the result can be > either a list or a map. Still, you can do it like this > > for (res <- S.params("results"); json <- JSONParser.parse(res)) json match > { > case m: Map[_,_] => for((k,v) <- m) k match { > case "foo" => println("Found foo %s".format(v)) > case y => println("Something else: %s".format(y)) > } > case x => println("Didn't parse a map: %s".format(x)) > } > > /Jeppe > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
