JSON to XML

Converts JSON values to XML documents.

The json values might contain multiple objects/values in which case these cannot be represented using XML without an artificial root node. For this reason we always create a root node. You can use the XPath node to remove it when possible (or to create a collection of XML values).

In general object keys starting with @ and having simple values get translated to xml attributes, the only exception could be for the key of the text if specified (which case it will be XML text). Every non-letter or number or _ character will be removed from the keys, which might cause ambiguity or create empty names -but will be kept as an attribute with key: ns:originalKey-, so it is recommended to stick to English letters in JSON object keys.

Options

Settings

Input column
Column containing JSON values
Replace input column
Replace input column, keep its name
Append new column
Name of the new (XML) column
Specify namespace
If unchecked, no base namespace will be set.
Namespace
The base namespace
Root element name
There is always a root element, you can specify its name.
Array item name
Array items not always can be represented as trees (for example arrays within arrays, or primitive types within arrays). In this case an XML element with the specified name will be created for each array entry.
Use parent keys as element name for arrays
When checked, JSON such as {"a":[{"b":2},{"c":3}]} gets translated to <a><b>2</b></a><a><c>3</c></a> otherwise, it is translated to: <a><item><b>2</b></item><item><c>3</c></item></a>.
Represent values as XML text if key is
When checked, simple values with the specified key will not create attributes, but provide the single text of the surrounding element.
Translate JSON key #comment to
JSON objects with keys starting with a hash sign such as { "#comment": "content" } can either be translated to XML elements (<comment ns:originalKey="#comment">content</comment>) or to XML comments (<--content-->).
Translate JSON key ?pi to
JSON objects with keys starting with a question mark such as {"?pi": "content"} can either be translated to XML elements (<pi ns:originalKey="?pi">content</do>) or to XML processing instructions (<?pi content?>)
Remove invalid XML characters from values
XML 1.0 supports only a limited set of characters (see RFC). When checked, invalid characters will be removed from values.

Type information

Keep type information by adding namespace
When checked, the JSON type information will be preserved, numbers, booleans, ... will be represented as text, but their node will have a prefix identifying its type. Otherwise all kind of values will be represented as text.
Empty list
Only used for the [] JSON array when the Omit type information is unchecked. Otherwise it is not possible to distinguish between [] and {}.
Boolean
Prefix for the boolean values.
Decimal
Prefix for the floating point/decimal values.
Integer
Prefix for the integer values.
Null
Prefix for the null values.
String
Prefix for the String/text values.

Input Ports

Icon
A table with JSON column

Output Ports

Icon
Table with the converted XML column

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.