1

Are there any good JSON to XML and Vice-versa java lib converters available, Which can convert the formats on the fly. On the fly means, if i give a JSON object (not .json file reader sorts) it should gimme back an xml document (and not .xml file) .

Tried XStream, but its giving me unwanted Element nodes which is not required in my xml. The converter in Json.org was close, but it creates only Text/node based XML and NOT creating attribute based.

Eg: If my JSON data is :

{Order:{OrderLine:{ItemID:"1234"}},OrderNo:"4567"}

Output that i want is :

<Order OrderNo="4567"><OrderLine ItemID="1234"/></Order>

Any thoughts?

Aki
  • 743
  • 3
  • 10
  • 17

1 Answers1

0

Have you tried the json-lib library? http://json-lib.sourceforge.net/usage.html#xml

Rodrigo
  • 483
  • 8
  • 14
  • Hi Rod, Yup tried that too but even then it gives these unwanted nodes like etc. so couldnt go ahead with it. – Aki Jan 30 '13 at 05:34
  • Question, for any reason do you have the POJOs?, because your problem could be easily solved if you have them – Rodrigo Jan 30 '13 at 15:13