Parses messages as an XML document, performs a mutation on the data, and then overwrites the previous contents with the new value.

operator: to_json

EXPERIMENTAL: This processor is considered experimental and is therefore subject to change outside of major version releases.



Converts an XML document into a JSON structure, where elements appear as keys of an object according to the following rules:

  • If an element contains attributes they are parsed by prefixing a hyphen, -, to the attribute label.
  • If the element is a simple element and has attributes, the element value is given the key #text.
  • XML comments, directives, and process instructions are ignored.
  • When elements are repeated the resulting JSON value is an array.

For example, given the following XML:

<title>This is a title</title>
<description tone="boring">This is a description</description>
<elements id="1">foo1</elements>
<elements id="2">foo2</elements>

The resulting JSON structure would look like this:

"title":"This is a title",
"#text":"This is a description",



string An XML operation to apply to messages.

Options are: to_json.


array An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.