I would like to convert xml structure into json by using Jackson library
input xml:
<?xml version="1.0" encoding="UTF-8"?>
<xmldata>
<groups>
<fields>
<disabled>true</disabled>
</fields>
</groups>
</xmldata>
output json should be:
{
"xmldata": {
"groups": {
"fields": {
"disabled": true
}
}
}
}
but instead of "disabled": true (boolean) I get "disabled": "true" (string)
do I need to add some configuration or is it not possible out-of-the-box?
I'm using this mapper config:
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
XmlFactory xmlFactory = new XmlFactory(new WstxInputFactory(), new WstxOutputFactory());
XmlMapper xmlMapper = new XmlMapper(xmlFactory, module);
xmlMapper.registerModule(new Jdk8Module());
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
PS: no POJOs involved (and I would like to keep it that way)
Thx in advance
regards