XML to JSON transformer
XML to JSON transformer
The XML to JSON transformer transforms the provided XML String to a JSON object. The result will be returned as an object instance.
In the table below, you will find an explanation of these properties. All attributes with a '*' are mandatory.
Attribute |
Description |
Name* |
By default, we fill this out with the technical ‘tag’, followed by a serial number. Changing the name is optional. |
Enabled |
Set this value to true, if you want this service to be enabled. |
Omit Root Element |
If this value is true, the root element used in the XML file will be stripped from the JSON output. |
MessagePart-In |
Name of the MessagePart in a ConnectMessage where the content of the file is being stored. |
MessagePart-Out |
Name of the MessagePart in a ConnectMessage where the content of the file is being stored. |
Description |
Description of the specific service. This is for documentation purposes. |
Conversion issues
Because the converter has to figure out what type of conversion must be done to preserve your values, you can get some conversion issues.
For instance, check the next XML file:
<Passes>
<Pass>
<Id>0DB6D6C5</Id>
<Type>116</Type>
</Pass>
<Pass>
<Id>068256E9</Id>
<Type>116</Type>
</Pass>
<Pass>
<Id>0DB95FA5</Id>
<Type>116</Type>
</Pass>
</Passes>
After conversion you will get the following JSON file:
{ "Passes": {"Pass": [
{
"Type": 116,
"Id": "0DB6D6C5"
},
{
"Type": 116,
"Id": 6.8256E13
},
{
"Type": 116,
"Id": "0DB95FA5"
}
]}
}
You see that the second entry is a decimal instead of a string. This has happened because the original value was 068256E9, which is a number not a string.
The converter tries to be a helpful smart assistant, but in this case it predicted the value wrong.
If you have any issue like this, use Mapforce to correct this or try to make this value always a string. In this case it is a HEX value so we could place an x in front of the value, like this: x068256E9.