DataSonnet Header
The header is an optional comment section in the mapping document which must start with /** DataSonnet
followed by a new line character and end with a line */
and contains a set of configuration properties.
The properties are hierarchical, with sections separated by the .
(dot) character, e.g.:
input.payload.application/xml.NamespaceSeparator=: input.payload.application/xml.TextValueKey=__text input.myVar.application/csv.Quote=" input.myVar.application/csv.Separator=|
The header must be the first comment before any other line of code, in the following format:
/** DataSonnet version=<VERSION_NUMBER> <PROPERTY>=<VALUE> ... */
Example
/** DataSonnet version=1.0 */ //DataSonnet mapping starts here { mappedValue: payload.value }
The header is optional; if omitted, all default settings will be used. The default version is 1.0. For the data format-specific defaults see the Data Formats section.
Data Format Properties
The data format properties control the data format plugins behavior. The property names must start with one of input|output|*
.
The input properties format must be input.<INPUT_NAME>|*.<MIME_TYPE>.<MIME_TYPE_SPECIFIC_PARAMETER>
, where:
-
<INPUT_NAME>
is a name of input variable or payload; -
<MIME_TYPE>
is a mime type supported by DataSonnet; -
<MIME_TYPE_SPECIFIC_PARAMETER>
is one of the parameters supported by the plugin for this mime type.
If a property is not recognized, an error will be raised.
if the mime type contains the dot (. ) character, it must be escaped with a backslash (\ ). For example, dataformat.application/vnd\.ms-excel.payload.param=xyz .
|
Keys may not contain double backslashes (\\
), though values may.
The wildcard *
can be used to set the same parameter value for all inputs and output of the given format, instead of defining it explicitly. For example:
*.application/csv.Separator=|
is an equivalent of:
input.payload.application/csv.Separator=| input.myVar.application/csv.Separator=| output.application/csv.Separator=|
The wildcard may be used for inputs only, e.g.
input.*.application/csv.Separator=| output.application/csv.Separator=,
An explicit setting will override the wildcard setting for a specific input or output. For example, if there are multiple CSV inputs that have separator |
except one that has separator ,
, the following configuration can be used:
dataformat.application/csv.*.Separator=| dataformat.application/csv.commaSeparatedVar.Separator=,
For the list of the supported data formats and their configurable properties, see the Data Formats section.
Miscellaneous Properties
Header | Description | Required | Default value |
---|---|---|---|
|
DataSonnet language version. Currently this property has no effect on the DataSonnet behavior. |
no |
|
|
Controls whether order of fields as they appear in the mapping will be preserved in the resulting JSON. |
no |
|