Quantcast

Camel-XMLJSON

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Camel-XMLJSON

anush24
This post has NOT been accepted by the mailing list yet.
Hi,
I am new to camel and I am using camel-xmljson (https://camel.apache.org/xmljson.html)  component to convert JSON to XML and XML back to JSON and it works well in spring XML. For example
{
"operand1": 5,
"operand2":8
}

gets unmarshals to

<numbers>
<operand1 type="number">5</operand1>
<operand2 type="number">8</operand2>
</numbers>

The dataformat configuration I used to achieve this is as follows:

<dataformats>
 <xmljson
                forceTopLevelObject="true" id="xmljsonWithOptions"
                removeNamespacePrefixes="true" rootName="numbersXmlIn"
                skipNamespaces="true" trimSpaces="true" typeHints="YES"/>
 </dataFormats>


My question is
1. I would like to know if there is any way to map the node names(operand1->op1) in spring XML while  unmarshalling without involving any java code. ie
{
"operand1": 5,
"operand2":8
}
should get unmarshalled to
<numbers>
<op1 type="number">5</op1>
<op2 type="number">8</op2>
</numbers>

2. Would I be able to restructure my xml elements names while unmarshalling to the following
<numbers>
    <operands>
         <number>5</number>
         <number>8</number>
     </operands>
</numbers>
during conversion.

Thanks
Anu
Loading...