Convert XML to JSON Format

Use this step to convert XML to JSON.

Last published at: September 5th, 2025

XML to JSON converter step

Description:

This step converts XML-formatted data into JSON format.

The Convert XML to JSON workflow step accepts an XML document, parses its structure, converts it into an equivalent JSON representation, and stores the generated JSON in a FlowWright Variable or Global Variable.

This step provides an efficient way to integrate XML-based systems with REST APIs, JSON-based applications, modern web services, JavaScript clients, and cloud-based integrations without requiring custom code.

The generated JSON can be consumed immediately by downstream workflow steps, REST API calls, document generation processes, or external systems.

The step supports:

  • XML to JSON conversion
  • Processing of XML documents
  • Automatic JSON generation
  • Storage of generated JSON in Variables or Global Variables
  • Integration with FlowWright workflow automation
  • Support for downstream JSON processing

This step can be used for:

  • REST API integrations
  • Cloud application integration
  • JSON document generation
  • Legacy system modernization
  • Workflow data transformation
  • Data migration
  • Business process automation

 

Inputs

  • Input XML – Specify the XML document or string to be converted to JSON.
  • Variable/Global to Store JSON – Specify the Variable or Global Variable that will receive the generated JSON.
 

 

Returns

  • True – The XML was successfully converted, and the generated JSON was stored.
  • False – The XML could not be parsed, or the JSON conversion failed.
 

 

Usage:

The Convert XML to JSON step is typically placed after XML data retrieval, SOAP web service calls, XML document processing, or XML file imports where JSON output is required.

The workflow parses the supplied XML, converts it to JSON, stores the generated JSON in the configured Variable or Global Variable, and makes the result available to subsequent workflow steps.

A typical workflow might look like this:

 

Once the JSON has been generated, later workflow steps can:

  • Execute JSONPath queries
  • Call REST APIs
  • Populate web applications
  • Generate reports
  • Update workflow variables
  • Synchronize cloud services
  • Continue workflow processing

The input XML should contain valid XML before this step is executed.

Typical workflow suggestions:

  • XML-to-JSON conversion - Use this step when XML content needs to be converted to JSON during workflow processing.
  • Preparing data for JSON-based processing - Convert XML to JSON before passing the result to downstream processing that expects JSON.
  • Integration preparation - Use the converter when XML data needs to be converted to JSON before subsequent integration processing.
  • Data-format conversion - Use the step when a workflow receives or creates XML but subsequent workflow processing requires the data in JSON format.
  • API or service preparation - Where a downstream workflow operation requires JSON content, use clsXMLToJSONConverter to create the JSON representation before that operation.
  • Store converted data for reuse - Store the generated JSON in a clearly named Variable/Global so that subsequent steps can reference the converted result.

 

Example:

Let’s build and execute the “clsXMLtoJSONconverterDef” example.          

  • Create a new process definition called “clsXMLtoJSONconverterDef” and open the definition in designer mode. 
  • Drag a “clsXMLtoJSONconverter” step to the canvas. 
  • Connect the dots between the “Start” and “clsXMLtoJSONconverter” steps, as shown above.  
  • Click the “clsXMLtoJSONconverter” step to configure its “Required” properties. Provide a name for the step, the XML code, and a variable or global reference to store the JSON result. Then click the Save button. Note: Click the "AI Predict" button for the Copilot to add new process steps that match your process description. 

 

  • The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

 

  • The XML code is provided here for reference. 
<widget>
    <debug>on</debug>
    <window title="Sample Konfabulator Widget">
        <name>main_window</name>
        <width>500</width>
        <height>500</height>
    </window>
    <image src="Images/Sun.png" name="sun1">
        <hOffset>250</hOffset>
        <vOffset>250</vOffset>
        <alignment>center</alignment>
    </image>
    <text data="Click Here" size="36" style="bold">
        <name>text1</name>
        <hOffset>250</hOffset>
        <vOffset>100</vOffset>
        <alignment>center</alignment>
        <onMouseUp>
            sun1.opacity = (sun1.opacity / 100) * 90;
        </onMouseUp>
    </text>
</widget>

 

  • Save the Process Definition. Create a new Process Instance and execute it. When the workflow reaches the Convert XML to JSON step, FlowWright parses the supplied XML, converts it to JSON, and stores the generated JSON in the configured Variable or Global Variable. If the operation completes successfully, the workflow follows the True return path. If the XML is malformed, empty, contains invalid syntax, or cannot be converted, the workflow follows the False return path. Click the process step to view its properties. The step should successfully generate the JSON document, populate the configured Variable or Global Variable, and return True upon completion.

 

Tips:

  • Verify that the input XML is well-formed before executing the workflow.
  • Store the generated JSON in a Global Variable when multiple workflow steps require access to the converted data.
  • Use this step immediately after SOAP web service calls or XML document retrieval.
  • Combine this step with JSONPath, REST Call, or JSON to XML steps when additional JSON processing or bidirectional format conversion is required.
  • Validate the generated JSON before sending it to external REST APIs or cloud services.
  • Use the True and False return paths to implement appropriate success and exception handling.
  • Combine this step with SOAP Web Service, Get Form Instance Data, REST Call, JSONPathToList, or Generate Document workflow steps to automate XML-to-JSON integration workflows.

 

Notes:

  • The input must contain valid XML.
  • The generated JSON is stored in the configured Variable or Global Variable.
  • Nested XML elements are converted into equivalent JSON objects and arrays where appropriate.
  • Invalid or malformed XML input causes the step to follow the False return path.
  • This step converts data formats only and does not modify the original XML.
  • The resulting JSON structure is determined by the hierarchy and content of the input XML.
  • The workflow should include appropriate handling for both True and False return paths.
  • XML-to-JSON conversion is particularly useful when integrating traditional XML-based enterprise applications with modern REST services and JavaScript-based applications.

 

Feature Comparison: clsXMLToJSONConverter vs. XMLToTXT vs. XMLToXLS

All three FlowWright steps take XML-related input and convert or write it into another representation, but their intended outputs are different:

  • clsXMLToJSONConverter converts XML into JSON and stores the JSON in a Variable/Global.
  • XMLToTXT writes XML data to a TXT file, with optional row and column delimiters.
  • XMLToXLS writes XML data to an XLS file, with optional worksheet, XPath, and column-heading configuration.
Feature clsXMLToJSONConverter XMLToTXT XMLToXLS
Purpose Converts XML to JSON format Writes XML to a TXT file Writes XML to an XLS file
Category Development File System File System
Internal name clsxmltojsonconverter xmltotxt xmltoxls
Label Convert XML to JSON Writes XML to a TXT file Writes xml to xls file
Display name Convert XML to JSON Format Write XML to TXT Write XML to XLS
Namespace FlowWright.Workflow.ClsXmlToJsonConverter FlowWright.Workflow.XmlToTXT FlowWright.Workflow.XmlToXLS
DLL FlowWright.Workflow.dll FlowWright.Workflow.dll FlowWright.Workflow.dll
Step definition type Process Process Process
Input connections 2 2 2
Output connections 2 2 2
Number of configurable properties 2 5 5
Primary input Input XML Variable/Global containing XML Variable/Global containing XML
Output destination Variable/Global containing JSON TXT file path XLS file path
Input XML property inputXml xmlVariable xmlVariable
Input XML label Input XML Variable/Global that holds the XML Variable/Global that holds the XML
Input XML required? Yes Yes Yes
Input XML data type multilineTextBox string string
Output destination property jsonOutputVar txtFilePath xlsFilePath
Output destination required? Yes Yes Yes
Output destination data type string string string
Column headings Not available Optional Optional
Row delimiter Not available Optional Not available
Column delimiter Not available Optional Not available
XPath/XML node selection Not available Not available Optional
Worksheet name Not available Not available Optional
Output format JSON TXT XLS
Output stored in Variable/Global? Yes No—the configured destination is a TXT file path No—the configured destination is an XLS file path
Returns True / False True / False True / False
Best suited for XML-to-JSON conversion and downstream JSON processing Generating delimited text files Generating spreadsheet files from XML
Property types Multiline text box + string String + checkbox String + checkbox
Specialized configuration Direct XML input Delimiters and column headings XPath, worksheet name, column headings

 

Definition Sample:

You may provide a sample process definition containing the clsXMLToJSONConverter step and import it into the FlowWright Process Definition (XML file) page.

After importing the sample, configure:

  • Input XML
  • Variable/Global to store JSON
  • Connections to the preceding and subsequent workflow steps

For example:

Input XML: XML content generated or obtained by the workflow
Variable/Global to store JSON: ConvertedJSON

A useful demonstration workflow is:

Start → Prepare XML → clsXMLToJSONConverter → Process JSON → Stop

After execution, verify that ConvertedJSON contains the expected JSON representation.

 

A common pattern for the clsXMLToJSONConverter step is:

Start → Obtain/Generate XML → Convert XML to JSON → Use JSON → Continue

Click here to download the sample file.