All guides

n8n XML to JSON: arrays, attributes and root nodes

Convert existing XML into an inspectable structure with explicit array and attribute rules.

AINavWritten / Updated Sources checked
On this page

At a glance

This guide explains an AI workflow data task from official node documentation and checks public synthetic inputs locally. It does not run n8n, sign in or call a model API. Documented steps and local inspection are separate.

Input, conversion and checks

  1. Prepare input

    Inspect actual data, fields and prerequisites.

  2. Select conversion

    Choose the task mode and destination field.

  3. Inspect output

    Account for missing items and errors before continuing.

Establish input and receiver contracts before downstream work.

Distinguish XML text from binary files

The fixture has a records root and two record elements with id attributes and text children. XML converts data formats. If XML is in a binary file, the documentation says to extract it as text first. Establish that the input property contains text rather than treating a download path as XML.

Establish JSON structure options

Select XML to JSON and set Property Name to the source property. Attribute Key defaults to $ and Character Key to _. Explicit Array puts child nodes in arrays when enabled; when disabled, an array is created only for multiple children. Explicit Root controls retention of the root. Ignore Attributes drops attributes and makes Merge Attributes ineffective.

Inspect repeated elements and identity

A standard XML parser inspected both record IDs and texts locally. It did not run the n8n converter, so its object shape is not node output. In actual execution, inspect single and multiple records, the root and attribute placement before AI calls. Stop on mixed scalar and array handling, lost IDs or parse failures.

Article sources

Original editorial content; official descriptions and checking suggestions are distinguished.

  1. n8n · Official sources
    View details