Thanks Richard! This is a feature request and I just committed an implementation to my branch. I modified existing example to contain few attributes to show how they are mapped:
http://github.com/dpp/liftweb/blob/joni_wip_xml/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala If other committers give it the green light I will push it to master. Cheers Joni On Oct 5, 5:41 pm, Richard Dallaway <dalla...@gmail.com> wrote: > Loving the new lift-json code. We've been producing XML for a REST > API, and now need to produce JSON. lift-json to the rescue, > except...the Xml converter doesn't handle attributes: > > scala> val xml = <user id="7"><name>Bert</name></user> > xml: scala.xml.Elem = <user id="7"><name>Bert</name></user> > > scala> val json = toJson(xml) > json: net.liftweb.json.JsonAST.JValue = > JObject(List(JField(user,JObject(List(JField(name,JString(Bert))))))) > > scala> JsonDSL.compact(JsonAST.render(json)) > res5: String = {"user":{"name":"Bert"}} > > I'd expect res5 to be something like: {"user":{"id":"7","name":"Bert"}} > > I'm either missing a clue, or this is a feature request. > > I can see there's ambiguity in how you might map the above JSON back > to XML with attributes, but it seems reasonable that if you have XML + > attributes they would be present in a JSON representation. > > Thank you > Richard --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---