DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Loading XML into MongoDB
  • Migrating MuleSoft System API to AWS Lambda (Part 1)
  • Validate XML Request Against XML Schema in Mule 4
  • MDC Logging With MuleSoft Runtime 4.4

Trending

  • Go 1.24+ Native FIPS Support for Easier Compliance
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 2
  • Caching 101: Theory, Algorithms, Tools, and Best Practices
  • Understanding the Shift: Why Companies Are Migrating From MongoDB to Aerospike Database?
  1. DZone
  2. Coding
  3. Languages
  4. MuleSoft 4.0 BETA (XML to JSON Transformation)

MuleSoft 4.0 BETA (XML to JSON Transformation)

This tutorial explains how to transform XML to JSON.

By 
Varun Goyal user avatar
Varun Goyal
·
Jul. 02, 18 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
15.3K Views

Join the DZone community and get the full member experience.

Join For Free

Step 1

Open Anypoint studio and create a new project as shown namely as xml2json.

  • Drag and drop an HTTP listener Connector to get a request for your servers and give the host and port numbers. Like here, the host is set to mule4.eaiesb.com and port to 8099 and test your connection to check whether the port is in use or not by testing the connection successfully.
  • After the successful connection and verification that the port is not reserved, set the path for your service as: /xml2json

Step 2

Drag a transform message from the Mule palette.

  • It helps us to transform the Mule message from the XML to JSON as shown:

Image title

Step 3

Set the input metadata and output metadata format.

  • Click on +Add to select the input XML schema file and give a friendly name like StudentsXMLSchema.
  • Select the type as XML and from Schema, select an input file as here: Students.xsd as shown below:

Image title

  • Set the output metadata and Type ID: StudentsJSONSchema is used as the name by selecting Type as JSON and set the Schema as here: Students.json and create the desired output structure as shown:

Image title

Step 4

Map input metadata fields to output fields.

  • Once you map the field, the transform message will write the code with respect accordingly to that shown below:

Image title

Step 5

Run the Mule project.

By default, Mule will download all the artifacts from the Maven repository and once the project does not have errors, it will show a successful deployment.

Step 6

Open the Postman and hit the service URL request as shown:

  • Select the method as POST and go to body and select raw in it. Select the DataType as XML and give the XML data in body and click on Send.

Image title


Step 7

Check the output response data in the JSON format transformed successfully.

Image title

Happy Learning!!

XML JSON BETA (programming language) MuleSoft

Opinions expressed by DZone contributors are their own.

Related

  • Loading XML into MongoDB
  • Migrating MuleSoft System API to AWS Lambda (Part 1)
  • Validate XML Request Against XML Schema in Mule 4
  • MDC Logging With MuleSoft Runtime 4.4

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!