I need to convert Json file format into XML format, I've seen a lot of webpages that use this even in java I can see there are a lot of people who are capable of doing it but I can't find a way on groovy.
I have a file like this one:
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
And I'd like to be able to convert directly to XML, since we need to use that to dynamically create the request for an operation.
Thank you in advance guys
There is underscore-java library with static methods fromJson and toXml.
output:
Her is the link that can help you.
Based on the above link, here is the complete groovy script for the same.
By the way, you need to download the library and add it to the classpath, in this case copy it under SOAPUI_HOME/bin/ext directory.