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.

 

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 the document into JSON format, 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.

 

Definition Sample:

You may download the sample definition(s) from the link provided and later import them (drag-and-drop) into your FlowWright Process Definition page.

Note: Verify and complete any missing configuration after importing the sample, including:

  • Input XML
  • JSON output Variable or Global Variable mapping
  • Workflow variable definitions
  • Downstream JSON processing configuration
  • Environment-specific settings

After verifying the configuration, save the Process Definition before execution.

Click here to download the sample file.