This page is no longer maintained — Please continue to the home page at www.scala-lang.org

JSON to XML

1 reply
mal
Joined: 2008-09-18,
User offline. Last seen 2 years 4 weeks ago.

I want to transform JSON into XML.

This is to provide both JSON and XML as weather data feeds at
http://www.bom.gov.au

So far, I've parsed the JSON using Derek's
scala.util.parsing.json.JSON.parseFull() parser.

It returns a scala.collection.immutable.Map1 which is an Iterable. So far so
good.

How do I traverse it as a tree?

Mal.

tolsen77
Joined: 2008-10-08,
User offline. Last seen 1 year 38 weeks ago.
Re: JSON to XML
Aside from making Mr. Crockford angry, you could maybe make a recursive function that pattern match against the JSON structures and do depth-first traversal and returning the XML node on the function call.

On Tue, Mar 10, 2009 at 8:11 AM, Malcolm Gorman <malcolm.gorman@gmail.com> wrote:

I want to transform JSON into XML.

This is to provide both JSON and XML as weather data feeds at
http://www.bom.gov.au

So far, I've parsed the JSON using Derek's
scala.util.parsing.json.JSON.parseFull() parser.

It returns a scala.collection.immutable.Map1 which is an Iterable. So far so
good.

How do I traverse it as a tree?

Mal.
--
View this message in context: http://www.nabble.com/JSON-to-XML-tp22429085p22429085.html
Sent from the Scala - User mailing list archive at Nabble.com.


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland