Solved by coworker: private def handleMarkup(xml: Node): Node = { (xml map { case Elem(prefix, "markup", attributes, scope, children @ _*) => { Utility.trim(Elem(prefix, "markup", attributes, scope, Text(children.foldLeft("")(_ + _.toString)))) } case Elem(prefix, label, attributes, scope, children @ _*) => { Elem(prefix, label, attributes, scope, children.map(handleMarkup(_)) : _*) } case x => x }).first }
On Feb 11, 1:51 pm, Mike <mike.c.single...@gmail.com> wrote: > Looking for some advise about encoding raw HTML to JSON. > > Here as some sample XML similar to what we are using: > <id>846</id> > <name>Mike</name> > <markup> > <div> > <h1>testing</h1> > </div> > </markup> > > When converting this XML to JSON I would like the "markup" element and > all of it's children to be returned as a big string. For example: > {"id": 846, "name": "Mike", "markup", "<div><h1>testing</h1></div>"} > > Right now it always tries to parse the children, resulting in > something similar to: > {"id": 846, "name": "Mike", "markup":{"div":{"h1":"testing"}} > > Any insights? -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.