On Jul 10, 6:32 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Fri, Jul 10, 2009 at 1:44 AM, Jeppe Nejsum Madsen <je...@ingolfs.dk>wrote:
>
>
>
>
>
> > "marius d." <marius.dan...@gmail.com> writes:
>
> > > Please take a look on JsObj.
>
> > That's what I'm using now and it's a pain:
>
> > def generateOptions = JsObj(
> > ("title", "My title"),
> > ("series", JsArray(JsObj(("Label","MyLabel")))),
> > ("seriesColors", JsArray("#000000","#cccccc")),
> > ("axes", JsObj(
> > ("xaxis", JsObj(
> > ("renderer", JsVar("$.jqplot.CategoryAxisRenderer")),
> > ("ticks", JsArray(data.flatMap(series =>
> > {series.labels.map(v => v.toString)}) : _*))
> > )),
> > ("yaxis", JsObj(
> > ("min", 0),
> > ("tickOptions", JsObj(
> > ("formatString", "%d")
> > ))
> > ))
> > )),
> > ("seriesDefaults", JsObj(
> > ("renderer", JsVar("$.jqplot.BarRenderer")),
> > ("rendererOptions", JsObj(
> > ("barDirection", "horizontal"),
> > ("barPadding", 8),
> > ("barMargin",20),
> > ("barWidth", 20)
> > ))
>
> > )))
>
> Looks like Lisp... :-)
>
> In all seriousness, one of the pieces of Goat Rodeo
> (http://goatrodeo.organdGoat Rodeo will become part of Lift once GR
> is stable) is objects that
> will know how to serialize themselves as JSON. So, you'll get type safety
> and bi-direction serialization. In the mean time, I think Marius has some
> stuff in Record that also does bi-directional JSON.
Correct Dave.Guys please see Record#asJson and Record#fromJSON
>
>
>
>
>
> > > But what is your exact use case? ... generate JSON constructs from
> > > Scala and send then to browser?
>
> > Yes, I want the above JSON object (which is just a subset of the full
> > capabilities) to be generated in Scala, so I:
>
> > - will get typechecking
> > - Don't have to remember field names
> > - Can't get autocompletion on valid values for things like
> > - e.g. barDirection
>
> > /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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---