Class SimpleJsonTransformationDriver
- All Implemented Interfaces:
TransformationDriver
This uses the default json.org implementation to convert between JSON and XML.
When converting to XML, it will add a root element called json
(this is configurable via
setJsonTag(String)
) as the required XML root element. When converting from XML then it expects the same
tag as the root element of the XML.
If your input is a relatively JSON object, then this is the transformation driver to use.
The key differentiator is that where the output should be
a JSON array with a single element; it will not be supported by this driver implementation. You can still use it, but you will
have to execute a JsonTransformService
afterwards to change the cardinality.
If the input is a JSON array, then json-array
(not configurable) will be added as the root element, that wraps the JSON
array.
In the adapter configuration file this class is aliased as simple-transformation-driver which is the preferred alternative to the fully qualified classname when building your configuration.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the JSON tag.void
setJsonTag
(String jsonTag) Set the JSON tag.transform
(String input, TransformationDirection direction) Perform transformation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.adaptris.core.transform.json.TransformationDriver
transform
-
Constructor Details
-
SimpleJsonTransformationDriver
public SimpleJsonTransformationDriver()
-
-
Method Details
-
transform
Perform transformation..- Specified by:
transform
in interfaceTransformationDriver
- Parameters:
input
- The data to transform.direction
- The direction of the transformation.- Returns:
- The transformed data.
- Throws:
ServiceException
- Thrown if there is a problem with the transformation.
-
getJsonTag
Get the JSON tag.- Returns:
- The JSON tag.
-
setJsonTag
Set the JSON tag.- Parameters:
jsonTag
- The JSON tag.
-