Posts

Json To xml transformation using jackson , XPath and Mvel script.

Image
Let consider a scenario where there is an API which takes Json payload as input and makes downstream system Api call which accepts XML as input.  This requires a transformation logic of Json to XML and vice versa. In some scenarios we may require very complex transformation that includes iteration of elements, control flows and variables etc. This tutorial mainly focuses on the transformation of Json payload to xml payload in generic configurable way using Jackson, XPath and Mvel script. Design:     The intention of this design to keep the transformation logic away from the application code with the help of Mvel script. This Mavel script contains the actual transformation logic of extraction of source value from Json using Jackson library and substitute this value in the given xml template using XPath. We can have this Mvel script stored somewhere in  db or in any configuration resource folder and can pass dynamically to our application transformation logic.  ...