Contact Free trial Login

Anypoint Exchange

Home to the complete listing of connectors, templates, examples and APIs.
Discover and use proven assets built by the MuleSoft ecosystem, or add assets to a private
tenant of Anypoint Exchange for collaboration and sharing of internal best practices.

Upload to FTP after converting JSON to XML

Upload to FTP after converting JSON to XML

(0 reviews)

This example application illustrates the concept of datamapping to convert JSON data to XML. It also shows you how to configure and use the FTP connector to upload a file to a FTP server.



This document assumes that you are familiar with Mule and Anypoint Studio. This example also assumes that you have a basic understanding of Mule flows, Mule Global Elements, and DataWeave.

Example Use Case

In this example JSON data is sent to the mule application through an HTTP end point. This data is then converted to the XML format using the DataWeave transformer after which the message payload is uploaded to the FTP folder.

Set Up and Run the Example

  1. Open the Example project in Anypoint Studio from Anypoint Exchange.
  2. In the Package Explorer, click the src/main/resources folder, double-click, and set properties to the following values:http.port ftp.port ftp.username ftp.password
  3. In the Package Explorer pane, right-click the project name and select Run As > Mule Application.
  4. Make a POST request using Postman to http://localhost:<your\\_HTTP\\_port> with following JSON message body, and setting the Content-Type header to application/json: { "employees": { "employee": [{"name": "John","lastName": "Doe","addresses": { "address": [ {
     "street": "123 Main Street",
     "zipCode": "111"
    }, {
     "street": "987 Cypress Avenue",
     "zipCode": "222"
    } ]}},{"name": "Jane","lastName": "Doe","addresses": { "address": [ {
     "street": "345 Main Street",
     "zipCode": "111"
    }, {
     "street": "654 Sunset Boulevard",
     "zipCode": "333"
    } ]}} ] } }
  5. Verify that the file muleExample.xml was uploaded to the upload folder on your FTP server.


Studio includes a feature that enables you to easily export all the documentation you have recorded for your project. Whenever you want to share your project with others outside the Studio environment, you can export the project's documentation to print, email or share online. Studio's auto-generated documentation includes:

  • A visual diagram of the flows in your application
  • The XML configuration which corresponds to each flow in your application
  • The text you entered in the Notes tab of any building block in your flow

Select File > Export Studio Documentation, select a project, specify a target directory, and then click Generate Studio Documentation.


Log into Anypoint Platform to download this asset


Created by
MuleSoft Organization
Published onJul 28, 2018


VersionRuntime version
Show more