« Return to Thread: outputting json
import net.liftweb.http.js._
import JE._
import JsCmds._
JsObj("Foo" -> 55, "bar" -> "baz", "rabbit" -> JsArray(44, 66, "Dog", JsObj("yep" -> true)))See the above code
Josh Joy wrote:Could you please be more specific for new people like me?
The link you provided goes to the Lift main web site. I used the wiki search for JSON and also searched Google, the closest thing I could find was JsonHandler .
Is that what you are referring to?
Yea...googling scala, lift, liftweb, json, jsonhandler (all various combinations of these keywords), doesn't really turn up much...You should use lift to build web apps. It's about 50 times better and easier than Spring.
I'm not sure what I missed on the liftweb homepage...
I'm just looking to integrate a nice and nifty json builder in an existing spring mvc app...
Scala's faster. Scala's radically better for building maintainable code. And, as I said, there's an excellent JSON builder in lift.
I would use groovy, though from what I can see so far Scala is a little bit faster than groovy, though in this case if scala doesnt have these features then I'll prolly just use groovy...
Please keep the discussions on the mailing. There are lots of people here to help. The lift list ( http://groups.google.com/group/liftweb?hl=en ) is the best place to get help with web based apps in Scala.
Thanks,
David
Thanks,
Josh
On Sun, Aug 3, 2008 at 4:46 PM, David Pollak <dpp@...> wrote:
As I said, lift has a JSON build.
Josh Joy wrote:Similar to the XML builder, how hard would it be implement a separate JSON builder in Scala?
I would like to do something similar that Groovy has in scala
http://www.jroller.com/aalmiray/entry/building_json_with_groovy
Thanks,
Josh
On Sat, Aug 2, 2008 at 8:06 PM, David Pollak <dpp@...> wrote:
Josh,
There's no way to convert from XML to JSON because XML contains sequences not expressible in JSON (e.g., multiple tags with the same name, attributes.)
lift (http://liftweb.net ) has JavaScript objects that will render themselves as strings.
Thanks,
David
Josh Joy wrote:
Hi,
I'm looking for a way to output (build) json.
For example, I see there is a way to build xml
http://www.scala-lang.org/intro/xml.html
object XMLTest2 extends Application {
import scala.xml._
val df = java.text.DateFormat.getDateInstance()
val dateString = df.format(new java.util.Date())
def theDate(name: String) = <dateMsg addressedTo={ name }>
Hello, { name }! Today is { dateString }
</dateMsg>;
println(theDate("John Doe").toString())
}
Is there a way to output JSON rather than xml?
Something similar to what I"m looking for is found in groovy
http://www.jroller.com/aalmiray/entry/building_json_with_groovy
Thanks,
Josh
« Return to Thread: outputting json
| Free embeddable forum powered by Nabble | Forum Help |