SlideShare a Scribd company logo
How to read JSON message
payload
16-05-2015
Abstract
• The main motto of this PPT is How to read
JSON message payload in our applications.
Introduction
• There is no standard language currently for
querying JSON data graphs in the same way
XPATH can query XML documents. Mule
provides a simple query syntax for working
with JSON data in Java, called JsonPath.
• You can use JsonPath in Mule expressions to
query JSON message payloads for filtering
or enrichment.
Example
.mflow
• <?xml version="1.0" encoding="UTF-8"?>
•
• <mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
• xmlns:spring="http://www.springframework.org/schema/beans"
• xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
• xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
• http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
• http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
• <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8088" doc:name="HTTP
Listener Configuration"/>
• <flow name="readingjsonFlow">
• <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
• <logger message="--flow started" level="INFO" doc:name="Logger"/>
• <set-payload value="{ &quot;Address&quot;:{ &quot;Country&quot;:&quot;India&quot;,
&quot;State&quot;:&quot;AP&quot;, &quot;City&quot;:&quot;Rajhamundry&quot; } }" doc:name="Set Payload"/>
• <logger message="--country:#[json:Address/Country]--state:#[json:Address/State]--city:#[json:Address/City]"
level="INFO" doc:name="Logger"/>
• </flow>
• </mule>
• Output:
• INFO 2016-05-06 17:43:57,248 [main] org.mule.module.launcher.MuleDeploymentService:
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• + Started app 'readingjson' +
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• INFO 2016-05-06 17:43:57,257 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• + Mule is up and kicking (every 5000ms) +
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• INFO 2016-05-06 17:43:58,580 [main] org.mule.module.launcher.StartupSummaryDeploymentListener:
• **********************************************************************
• * - - + DOMAIN + - - * - - + STATUS + - - *
• **********************************************************************
• * default * DEPLOYED *
• **********************************************************************
•
• *******************************************************************************************************
• * - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
• *******************************************************************************************************
• * readingjson * default * DEPLOYED *
• *******************************************************************************************************
•
• INFO 2016-05-06 17:44:30,742 [[readingjson].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --flow
started
• INFO 2016-05-06 17:44:31,103 [[readingjson].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --
country:India--state:AP--city:Rajhamundry
•
•
•
• Flow of execution:
1. URL to trigger the service from browser
http://localhost:8088
2. Using set-payload component we have set’s
the Input JSON as payload to the flow
3. Using MEL we have read and display values of
each and every key (JSON) In logger component
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.7/json-module-reference

More Related Content

Viewers also liked (20)

PPTX
Bean as Datasource
sivachandra mandalapu
 
PPTX
Dockerizing mule soft esb
sivachandra mandalapu
 
PPTX
How to use IMAP endpoint
sivachandra mandalapu
 
PPTX
Splitter
sivachandra mandalapu
 
PPTX
How to use poll scope
sivachandra mandalapu
 
PPTX
Integrate mule esb with microsoft office 365 share point
sivachandra mandalapu
 
PPTX
Securing api with_o_auth2
sivachandra mandalapu
 
PPTX
How to use processor chain
sivachandra mandalapu
 
PPTX
How to use parse template
sivachandra mandalapu
 
PPTX
Specifying a default exception strategy
sivachandra mandalapu
 
PPTX
How to use attachment transformer
sivachandra mandalapu
 
PPTX
How to use message enricher
sivachandra mandalapu
 
PPTX
How to use web service consumer
sivachandra mandalapu
 
PPTX
Defining global exception strategies
sivachandra mandalapu
 
PPTX
Soap Component
sivachandra mandalapu
 
PPTX
Integration with dropbox using mule esb
sivachandra mandalapu
 
PPTX
Mule esb with amazon s3 Integration
sivachandra mandalapu
 
PPTX
How to use batch component
sivachandra mandalapu
 
PPTX
How to use Request Reply scope
sivachandra mandalapu
 
Bean as Datasource
sivachandra mandalapu
 
Dockerizing mule soft esb
sivachandra mandalapu
 
How to use IMAP endpoint
sivachandra mandalapu
 
How to use poll scope
sivachandra mandalapu
 
Integrate mule esb with microsoft office 365 share point
sivachandra mandalapu
 
Securing api with_o_auth2
sivachandra mandalapu
 
How to use processor chain
sivachandra mandalapu
 
How to use parse template
sivachandra mandalapu
 
Specifying a default exception strategy
sivachandra mandalapu
 
How to use attachment transformer
sivachandra mandalapu
 
How to use message enricher
sivachandra mandalapu
 
How to use web service consumer
sivachandra mandalapu
 
Defining global exception strategies
sivachandra mandalapu
 
Soap Component
sivachandra mandalapu
 
Integration with dropbox using mule esb
sivachandra mandalapu
 
Mule esb with amazon s3 Integration
sivachandra mandalapu
 
How to use batch component
sivachandra mandalapu
 
How to use Request Reply scope
sivachandra mandalapu
 

Similar to How to read json message payload (20)

PDF
Mule ESB Interview or Certification questions
TechieVarsity
 
PDF
Top 50 MuleSoft interview questions
techievarsity
 
PPTX
Mule message
Son Nguyen
 
PDF
Mule esb and_relevant_components
Paaras Baru
 
PDF
A Workhorse Named Mule
David Dossot
 
PPTX
Mule integration
Son Nguyen
 
PPTX
Mule mel 5_tips
kunal vishe
 
PPTX
Mule esb mule message
sathyaraj Anand
 
PPTX
Mule messages
Padmanabhan Natarajan, CSM
 
PPTX
Mule parsing with json
Anirban Sen Chowdhary
 
PPTX
Mule esb
himajareddys
 
PPTX
Mule esb
himajareddys
 
PPT
Mule esb presentation 2015
Nagesh Penumarthy
 
PPTX
Mule
D.Rajesh Kumar
 
PPTX
Esb process
saikiran6423
 
PPTX
Mule esb
saikiran6423
 
PPTX
Mule esb kranthi
kranthikumar1210
 
PPTX
Mule esb kranthi
Earnest Stephen
 
PDF
Mule ESB
Yura Nosenko
 
PPTX
Niranjan mule esb
niranjan1234567
 
Mule ESB Interview or Certification questions
TechieVarsity
 
Top 50 MuleSoft interview questions
techievarsity
 
Mule message
Son Nguyen
 
Mule esb and_relevant_components
Paaras Baru
 
A Workhorse Named Mule
David Dossot
 
Mule integration
Son Nguyen
 
Mule mel 5_tips
kunal vishe
 
Mule esb mule message
sathyaraj Anand
 
Mule parsing with json
Anirban Sen Chowdhary
 
Mule esb
himajareddys
 
Mule esb
himajareddys
 
Mule esb presentation 2015
Nagesh Penumarthy
 
Esb process
saikiran6423
 
Mule esb
saikiran6423
 
Mule esb kranthi
kranthikumar1210
 
Mule esb kranthi
Earnest Stephen
 
Mule ESB
Yura Nosenko
 
Niranjan mule esb
niranjan1234567
 
Ad

More from sivachandra mandalapu (20)

PPTX
Mock component in munit
sivachandra mandalapu
 
PPTX
Jms selector
sivachandra mandalapu
 
PPTX
Sftplite
sivachandra mandalapu
 
PPTX
Object store
sivachandra mandalapu
 
PPTX
How to use SFTP
sivachandra mandalapu
 
PPTX
How to use secure property placeholder
sivachandra mandalapu
 
PPTX
Reference exception strategy
sivachandra mandalapu
 
PPTX
Validate json schema
sivachandra mandalapu
 
PPTX
Validation
sivachandra mandalapu
 
PPTX
Property place holder
sivachandra mandalapu
 
PPTX
Collection aggregator
sivachandra mandalapu
 
PPTX
Deployment options for mule applications
sivachandra mandalapu
 
PPTX
Setting up organization with api access
sivachandra mandalapu
 
PPTX
API gateway setup
sivachandra mandalapu
 
PPTX
Expression
sivachandra mandalapu
 
PPTX
Synchronous communication using jms back channel
sivachandra mandalapu
 
PPTX
Salesforce
sivachandra mandalapu
 
PPTX
Data Mapper
sivachandra mandalapu
 
PPTX
Wildcard Filter
sivachandra mandalapu
 
PPTX
Rest Component
sivachandra mandalapu
 
Mock component in munit
sivachandra mandalapu
 
Jms selector
sivachandra mandalapu
 
Object store
sivachandra mandalapu
 
How to use SFTP
sivachandra mandalapu
 
How to use secure property placeholder
sivachandra mandalapu
 
Reference exception strategy
sivachandra mandalapu
 
Validate json schema
sivachandra mandalapu
 
Property place holder
sivachandra mandalapu
 
Collection aggregator
sivachandra mandalapu
 
Deployment options for mule applications
sivachandra mandalapu
 
Setting up organization with api access
sivachandra mandalapu
 
API gateway setup
sivachandra mandalapu
 
Synchronous communication using jms back channel
sivachandra mandalapu
 
Wildcard Filter
sivachandra mandalapu
 
Rest Component
sivachandra mandalapu
 
Ad

Recently uploaded (20)

PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
PPT
digestive system for Pharm d I year HAP
rekhapositivity
 
PPTX
Latest Features in Odoo 18 - Odoo slides
Celine George
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPT on the Development of Education in the Victorian England
Beena E S
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
community health nursing question paper 2.pdf
Prince kumar
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
digestive system for Pharm d I year HAP
rekhapositivity
 
Latest Features in Odoo 18 - Odoo slides
Celine George
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 

How to read json message payload

  • 1. How to read JSON message payload 16-05-2015
  • 2. Abstract • The main motto of this PPT is How to read JSON message payload in our applications.
  • 3. Introduction • There is no standard language currently for querying JSON data graphs in the same way XPATH can query XML documents. Mule provides a simple query syntax for working with JSON data in Java, called JsonPath. • You can use JsonPath in Mule expressions to query JSON message payloads for filtering or enrichment.
  • 5. .mflow • <?xml version="1.0" encoding="UTF-8"?> • • <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" • xmlns:spring="http://www.springframework.org/schema/beans" • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" • xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd • http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd • http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> • <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8088" doc:name="HTTP Listener Configuration"/> • <flow name="readingjsonFlow"> • <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> • <logger message="--flow started" level="INFO" doc:name="Logger"/> • <set-payload value="{ &quot;Address&quot;:{ &quot;Country&quot;:&quot;India&quot;, &quot;State&quot;:&quot;AP&quot;, &quot;City&quot;:&quot;Rajhamundry&quot; } }" doc:name="Set Payload"/> • <logger message="--country:#[json:Address/Country]--state:#[json:Address/State]--city:#[json:Address/City]" level="INFO" doc:name="Logger"/> • </flow> • </mule>
  • 6. • Output: • INFO 2016-05-06 17:43:57,248 [main] org.mule.module.launcher.MuleDeploymentService: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • + Started app 'readingjson' + • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • INFO 2016-05-06 17:43:57,257 [main] org.mule.module.launcher.DeploymentDirectoryWatcher: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • + Mule is up and kicking (every 5000ms) + • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • INFO 2016-05-06 17:43:58,580 [main] org.mule.module.launcher.StartupSummaryDeploymentListener: • ********************************************************************** • * - - + DOMAIN + - - * - - + STATUS + - - * • ********************************************************************** • * default * DEPLOYED * • ********************************************************************** • • ******************************************************************************************************* • * - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - * • ******************************************************************************************************* • * readingjson * default * DEPLOYED * • ******************************************************************************************************* • • INFO 2016-05-06 17:44:30,742 [[readingjson].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --flow started • INFO 2016-05-06 17:44:31,103 [[readingjson].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: -- country:India--state:AP--city:Rajhamundry • • •
  • 7. • Flow of execution: 1. URL to trigger the service from browser http://localhost:8088 2. Using set-payload component we have set’s the Input JSON as payload to the flow 3. Using MEL we have read and display values of each and every key (JSON) In logger component