« Return to Thread: outputting json

Re: outputting json

by David Pollak :: Rate this Message:

Reply to Author | View in Thread

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