Fixed Width to JSON Transformation in Mule 4

Fixwidth to JSON Transformation in Mule 4

Transform message is used to convert fixwidth to json.


In transform message component, select fixwidth and map data accordingly as shown below:

Json file metadata settings in transform message component:

Connect both input and output metadata:

In set payload we need to set path of schema as shown below:

Method: POST



XML project code:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:file="" xmlns:ee=""
     xmlns="" xmlns:doc="" xmlns:xsi="" xsi:schemaLocation="">
     <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="55dee739-0788-4599-9a80-d276443bb26f" >
          <http:listener-connection host="" port="8085" />
     <flow name="test_fixwidthtojsonFlow" doc:id="4bde0cb2-0443-4d71-a831-e0dba5a6dca1" >
          <http:listener doc:name="Listener" doc:id="9158e7fc-8913-44f0-950a-464a56948942" config-ref="HTTP_Listener_config" path="/fix"/>
          <set-payload value="#[payload]" doc:name="Set Payload" doc:id="43e843b7-6d3a-46b3-803f-de992150507f" mimeType="application/flatfile; schemapath=input.ffd"/>
          <ee:transform doc:name="Transform Message" doc:id="9244ace0-abf9-42cd-bb66-761f53cb67ad" >
              <ee:message >
                   <ee:set-payload ><![CDATA[%dw 2.0
output application/json
payload map ( payload01 , indexOfPayload01 ) -> {
     id: payload01.ID,
     age: payload01.AGE

© 2020

Share on :

Mule 4:

XML to JSON in mule 4 Web service consumer VM Validation in Mule 4 Until Successful
Sub flow Set Variable & Remove Variable Set Transaction ID Scatter Gather Round Robin
Consume Restful Service CRUD in Mule 4 Parse Template Object to JSON Load Static Resource
JSON to XML Invoke Idempotent Filter ForEach Flat file to JSON
Fixwidth to JSON First Successful File Execute Error Handling
Email Dynamic Evaluate Custom Business Event CSV to JSON Copybook to JSON
Choice Router Async RabbitMQ

Mule 3:

Database Connector Async CXF Attachement XSLT
Mongo DB Cache scope Custom Business Event Gzip Compress Expression
SMTP For Each Expression Javascript Filter Reference
Salesforce Message Enricher Groovy Parse Template Idempotent
VM Poll Invoke Ruby Message
Webservice consumer Python Transformer reference Message Property Not
Collection Aggregator First Sucessful Catch Exception Strategy Reference Exception Strategy Or
Choice Message Chunk Aggregator Choice Exception Strategy Global Exception Strategy Schema Validation
Custom Aggregator Scatter Gather Custom Exception Strategy Batch Processing MEL
M Unit RAML Map Operator API Mocking Dataweave