0 ×

JSON To XML

StreamableJSON related functionality for KNIME version 4.1.0.v201911110939 by KNIME AG, Zurich, Switzerland

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?>)

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

A table with JSON column

Output Ports

Table with the converted XML column

Best Friends (Incoming)

Best Friends (Outgoing)

Workflows

Installation

To use this node in KNIME, install KNIME JSON-Processing from the following update site:

KNIME 4.1

A zipped version of the software site can be downloaded here. Read our FAQs to get instructions about how to install nodes from a zipped update site.

Wait a sec! You want to explore and install nodes even faster? We highly recommend our NodePit for KNIME extension for your KNIME Analytics Platform.

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.