I still don't understand how JsObj works.. I've tried almost every
combination, it's more like luck that some stuff i do works.

        def listLanguages(): LiftResponse = {

                def displayLanguage(l: Locale): (String, String) = {
                        var r = l.getDisplayLanguage
                        if (l.getDisplayCountry != "")
                                r += " | " + l.getDisplayCountry
                        return (l.toString, r)
                }
                JsonResponse(JsObj(
                                "results" -> 
JsArray(Locale.getAvailableLocales.flatMap(s =>
displayLanguage(s)) :_*)
                ))
        }

Believe me, i tried every possible combination of JsObj in there, it
*always* got to nag something. We really need some samples for stuff
like that..
One time it tells me that it needs a List(String, String), as soon as
i have that, it want's a List(String, JsExp), so i change it to that,
then it complains again over the first problem..

it really is the big time killer for beginners to play around with
stuff like that because the API-Docs are too "dry" to understand
anything from it.

best regards.


On 13 Jul., 18:06, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> pushed
>
> On Mon, Jul 13, 2009 at 8:17 AM, David Pollak <feeder.of.the.be...@gmail.com
>
>
>
> > wrote:
>
> > On Mon, Jul 13, 2009 at 7:18 AM, Jeppe Nejsum Madsen 
> > <je...@ingolfs.dk>wrote:
>
> >> Jeppe Nejsum Madsen <je...@ingolfs.dk> writes:
>
> >> > Hi,
>
> >> > Just figured out that while JsObj generates valid javascript
> >> > expressions, it doesn't generate valid JSON objects since it uses
> >> > single quotes instead of double quotes for strings.
>
> >> > Is there another way in Lift to generate JSON?
>
> >> On a slightly related note it seems as if JSONParser also accepts input
> >> which is not really JSON:
>
> >> scala> JSONParser.parse("{'text':2}")
> >> res0: net.liftweb.util.Box[Any] = Full(Map(text -> 2.0))
> >> scala> JSONParser.parse("{text:2}")
> >> res1: net.liftweb.util.Box[Any] = Full(Map(text -> 2.0))
>
> >> JSON requires strings to be surrounded with quotation marks (")
>
> >> This leads me to believe that this is all intentional :-)
>
> > I fixed the problem many months ago.  The fix broke some apps.  I backed
> > out the fix.  I'll un-back out the fix now.
>
> >> /Jeppe
>
> > --
> > 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
>
> --
> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to