JsonResponse(JsObj("results" -> JsArray(Content.findAll.map{ o =>
o.asJs } :_* )))

this works.

On Jul 13, 8:08 pm, fbettag <[email protected]> wrote:
> WebServices.scala:118: error: type mismatch;
>  found   : net.liftweb.http.js.JsExp
>  required: Iterable[net.liftweb.http.js.JsExp]
>                 JsObj("results" -> JsArray(Content.findAll.flatMap(_.asJs) 
> :_* ))
>                                                                      ^
> one error found
>
> On Jul 13, 7:23 pm, David Pollak <[email protected]>
> wrote:
>
>
>
> > On Mon, Jul 13, 2009 at 10:11 AM, fbettag <[email protected]> wrote:
>
> > > i've read almost every topic about JsonResponse and i've played with
> > > it for the _whole_ day. I don't get it to work and it drives me more
> > > than nuts by now.
>
> > > I just want a simple list dumped to json:
>
> > >        def listContents(): JsonResponse = {
> > >                JsonResponse(JsObj("results" ->
> > > JsExp(Content.findAll.flatMap
> > > (_.asJs))))
> > >        }
>
> > JsExp is abstract, so you can't instantiate one.
>
> > If the results field should be a JsArray, use:
>
> > JsObj("results" -> JsArray(Content.findAll.flatMap(_.asJs) :_* ))
>
> > > that was my final try. parts like this really need documentation.. by
> > > all means, my scala skill really isn't one of the things i can be
> > > proud of (yet), but getting sense out of those abstract docs is really
> > > more than hard.
>
> > > best regards.
>
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to