tr Skip to content
Black Friday FlowMattic for life, 12 payments of $33.25 Or $399 once. Nothing added for splitting Ends in --Days --Hrs --Min --Sec See the deal

XML to JSON: Parse XML Feeds and Files in WordPress Workflows

FlowMattic XML Parser module: a supplier's XML feed is converted to JSON and fields such as product_name and product_stock for the next workflow step.

FlowMattic’s XML Parser converts XML to JSON inside a workflow. Point it at an XML file URL, such as a supplier product feed, a sitemap or a partner export, and it returns the whole document as JSON plus individual fields you can map into the next step.

Plenty of systems still publish XML, while most modern APIs, AI agents and WordPress tools expect JSON or plain fields. This guide shows how the step works, what the output looks like, and the XML quirks to plan for.

What is the XML Parser?

XML Parser by FlowMattic is a built-in action module with one action, Parse XML File, described as “Parse any XML file URL into JSON data.” It sits under Utilities in the step picker (“Parse and extract values from XML”) with the other data tools, and it runs on your own WordPress server.

The step has a single field, XML File URL, for a publicly accessible XML file. You can type the address or map it from an earlier step.

How XML to JSON conversion works

  1. Add a trigger. A Schedule suits feeds you check regularly; a webhook suits a system that sends you a file URL.
  2. Add a step and choose XML Parser by FlowMattic, then Parse XML File.
  3. Enter or map the XML File URL.
  4. Test the step and look at the fields it returns.
  5. Map those fields into later steps. For repeated items, read the list out of result and loop over it with an Iterator.
FlowMattic workflow builder showing the XML Parser by FlowMattic step with the Parse XML File action and its XML File URL field.
An XML Parser step set to Parse XML File, with a feed address in XML File URL.

The step downloads the file, converts it, and returns two things: result, which holds the whole document as a JSON string, and a flattened field for each value, with nested names joined by underscores. The root element itself is not part of the names.

XML:
<catalog>
  <supplier>Northwind</supplier>
  <updated>2026-10-11</updated>
  <product sku="A1">
    <name>Travel mug</name>
    <stock>42</stock>
  </product>
</catalog>

Fields:
supplier                 Northwind
updated                  2026-10-11
product_attributes_sku   A1
product_name             Travel mug
product_stock            42

What the output contains

XMLIn the output
Nested elementsField names joined with underscores, such as product_name
AttributesAn attributes key, such as product_attributes_sku
Repeated elementsNumbered fields, such as tag_0 and tag_1 or url_0_loc; repeated elements with children that sit two or more levels down become one JSON string field instead
CDATA sectionsRead as plain text
Empty elementsAn empty object
The whole documentresult, as a JSON string

Use cases

Sync stock from a supplier feed

A supplier publishes stock levels as XML each night. Parse the feed, pick the product list out of result, and update each product in your store.

Flow: Schedule (Every Day) → Parse XML File → JSON Parser (Get JSON Value by Path) → Iterator → WooCommerce (update product)

Watch a client’s sitemap

An agency can check that a client’s sitemap still lists the pages it should. Pull the list of URLs out of result, count them, and alert the team if the number drops below what you expect.

Flow: Schedule (Every Week) → Parse XML File → JSON Parser (Get JSON Value by Path) → PHP Array (Get Array Count) → Filter → Send Email

Store a daily rate from an XML feed

Some exchange-rate and pricing services publish a daily XML file. Read the value you need and save it as a variable that other workflows use for price calculations.

Flow: Schedule (Every Day) → Parse XML File → FlowMattic Tools (Set Variable Value)

Publish listings from a partner export

A property portal or job board hands you an XML export. Turn each listing into a WordPress post on your site.

Flow: Schedule → Parse XML File → JSON Parser (Get JSON Value by Path) → Iterator → WordPress (New Post)

Log orders from a legacy system

An older ERP posts the URL of each order file to a webhook. Parse the file and store the order in a table your team can search.

Flow: Webhook (Capture Webhook Response) → Parse XML File → WP Tables (New Record)

Summarise a feed with an AI agent

Hand the JSON in result to an AI agent and ask for a short digest of what changed, then email it to the people who need it.

Flow: Schedule (Every Week) → Parse XML File → AI Agent → Send Email

Tips and gotchas

  • The input is a URL. The step reads a file from an address; it has no box for pasting XML text.
  • It requests the http:// address. An https:// URL is fetched over plain HTTP. A server that redirects HTTP to HTTPS normally still works, but a host that refuses plain HTTP connections won’t.
  • Check that something came back. If the file can’t be reached or isn’t valid XML, the step still reports success with an empty result. Put a Filter on result before steps that depend on it.
  • One item or many changes the shape. In a feed shaped like <rss><channel><item>, a single item gives fields such as channel_item_title, while two or more give one channel_item field holding a JSON list. Design for both if the count varies, or read from result.
  • Namespaced elements are skipped. Elements with a prefix, such as <g:price> in shopping feeds or <content:encoded> in blog feeds, don’t appear in the output.
  • Text wins over attributes. An element that has both, such as <price currency="USD">9.50</price>, keeps the text 9.50 and loses the attribute.
  • RSS has its own module. For blog and news feeds, the RSS Feed trigger is simpler, because it fires once per new item.

Related features

  • JSON Parser: read a value by path from result, or reshape it.
  • Iterator: run the next steps once for each product, listing or URL.
  • CSV Parser: the same job for CSV files.

FAQ

How do I convert XML to JSON in WordPress?

Add an XML Parser step to a FlowMattic workflow, choose Parse XML File and enter the file’s URL. The step returns the document as JSON in result and as individual fields named after the elements.

Can I parse an XML product feed automatically every day?

Yes. Start the workflow with a Schedule trigger set to Every Day and put the feed URL in Parse XML File. Read the product list out of result with Get JSON Value by Path, and an Iterator runs your update steps once per product.

Why are some fields from my feed missing?

Elements with a namespace prefix, such as g:price, are not included, and an attribute is dropped when its element also has text. Check result after a test run to see exactly what was read.

Does the XML Parser work with password-protected URLs?

The step has only the XML File URL field, with no authentication options. It needs a publicly accessible file, so use a URL that doesn’t require a login.

The XML Parser ships with FlowMattic and runs on your own server with the rest of the data tools. Try FlowMattic and turn your first XML feed into workflow data.

More from the blog