XML to JSON

Reads values from an XML column and converts them into JSON format.

  • If there are multiple pieces of text around inner elements, they are translated into elements of a JSON array.
  • Text content inside XML elements is stored under a specified key (default key is text).
  • If enabled, XML attributes are converted to JSON keys with an @ prefix.
  • If enabled, XML processing instructions are converted to JSON keys with a ? prefix.
Example:

The XML
<a>Hello <b>world</b>!</a>
becomes:
{
   "a": [
     "Hello ",
     {
       "b": {
         "text": "world"
       }
     },
     "!"
   ]
}

Options

Input column
Column containing XML values
Output handling
Select how the output JSON column should be handled.
  • Append: Adds a new JSON column.
  • Replace: Replaces the original column with the JSON column.
New column name
Name of the new (JSON) column
Text body translated to JSON with key
This key will be used for XML text content to be represented in JSON
Translate comments
When checked, comments (such as <!-- comment -->) will be translated with key: #comment, otherwise they are omitted in the JSON output
Translate processing instructions
When checked, processing instructions (such as <?do?>) will be translated with prefix ?, otherwise they are omitted in the JSON output

Input Ports

Icon
Table with an XML column.

Output Ports

Icon
Table containing the converted JSON 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.