For future reference:

                JSONParser.parse(S.params("results").first) match {
                        case Full(res: Map[String, String]) => {
                                        try { obj.name(res("name")) } catch { 
case e => }
                                        try { obj.content(res("content")) } 
catch { case e => }
                                        try { obj.language(res("language")) } 
catch { case e => }

                                        try {
                                                obj.save
                                                OkResponse()
                                        } catch {
                                                case e =>  Log.error("Could not 
save content", e);
                                                        
InternalServerErrorResponse()
                                        }
                        }
                        case _ => BadResponse()
                }

On Jul 15, 11:27 am, fbettag <[email protected]> wrote:
> Any variation i try gives me:
>
> (key, value) <- res
> value filter is not a member of Any
>
> On Jul 15, 11:22 am, "marius d." <[email protected]> wrote:
>
>
>
> > Try using for comprehensions
>
> >  for (res <- JSONParser.parse(S.params("results").first);
> >       (key, value) <- res) yield some_expression
>
> > Marius
>
> > On Jul 15, 11:51 am, fbettag <[email protected]> wrote:
>
> > > Args Sorry, the Full(Map(..)) gets returned by the JSON Parser.
>
> > > for (res <- JSONParser.parse(S.params("results").first); (key, value)
> > > <- res) {
> > >         Log.error(key + " -> " + value)
>
> > > }
>
> > > Anyhow it still doesn't run through the loop. This stuff is really
> > > over-complicated.
>
> > > On Jul 15, 10:20 am, Jeppe Nejsum Madsen <[email protected]> wrote:
>
> > > > On Wed, Jul 15, 2009 at 10:01 AM, fbettag<[email protected]> wrote:
>
> > > > > Ok, i found out that the POSTed JSON was in S.params("results").first,
> > > > > which contains:
>
> > > > > Full(Map(name -> New Content, language -> en, content -> , id -> ext-
> > > > > record-1))
>
> > > > > So i tried this:
> > > > >        for ((key, value) <- 
> > > > > JSONParser.parse(S.params("results").first)) {
> > > > >                Log.error(key + " -> " + value)
> > > > >        }
>
> > > > > But it doesn't go through the loop. I guess it has something to do
> > > > > with the Full() around the Map.
> > > > > I tried .elements on the returned Full() for an iterable, but it still
> > > > > doesn't run through the loop.
>
> > > > > Any ideas?
>
> > > > If S.params("results") contain
> > > > Full(Map(name -> New Content, language -> en, content -> , id -> ext-
>
> > > > > record-1))
>
> > > > It seems like it's already parsed, in which case you could do
>
> > > > for (results <- S.params("results"); (key, value) <-results) {
> > > >             Log.error(key + " -> " + value)
> > > >     }
>
> > > > /Jeppe
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to