Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:20:17+00:00 2026-06-18T16:20:17+00:00

Say I have a REST based service that returns a JSON object as under

  • 0

Say I have a REST based service that returns a JSON object as under

{
    "AlertDetails":
        {
            "start":0,
            "left":0,
            "_itemList":
                [   
                    {
                        "id":"badntp",
                        "text":"The time cannot be synchronized to the configured time server.",
                        "click":{
                                    "text":"Click here to modify your time settings.",
                                    "url":"datetime.html"
                                },
                        "severity":"warning",
                        "occurred":"20121031T10:18:54",
                        "args":null
                    },
                    {
                        "id":"updatesitefail",
                        "text":"The update site cannot be contacted to determine if software updates are available.",
                        "click":{
                                    "text":"Click here to manually check for updates.",
                                    "url":"http:\\\/\\\/xyz.com\\\/support\\\/xyz.html"
                                },
                        "severity":"info",
                        "occurred":"20121105T17:23:24",
                        "args":"[http:\\\/\\\/xyz.com\\\/support\\\/xyz.html]"
                    }
                ]
        }
}

Now I have a table in PostgreSQL(say testTable) whose structure is as under

ID       (string)
Severity (string)
Occurred (string)

How can I parse those values from the available JSON field to insert the same into the PostgreSQL Database from Mule ESB studio.

The final result in the testTable should be

ID                  Severity        Occured
---------           ---------       --------
"badntp"            "warning"       "20121031T10:18:54"
"updatesitefail"    "info"          "20121105T17:23:24"

My configuration file is as under

<jdbc:postgresql-data-source name="PostgreSQL_Data_Source"
    user="username" password="pwd" url="jdbc:postgresql://localhost:5432/TestDB"
    transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source" />

<jdbc:connector name="PostgreSQL_Connector" dataSource-ref="PostgreSQL_Data_Source"
    validateConnections="true" queryTimeout="-1" pollingFrequency="0"
    doc:name="Database">
    <jdbc:query key="InsertRecord"
        value="INSERT INTO &quot;testTable&quot;(&quot;ID&quot;,&quot;Severity&quot;,&quot;Occured&quot;) VALUES (?,?,?)" />
</jdbc:connector>

<flow name="testRestFlow1" doc:name="testRestFlow1">
    <http:inbound-endpoint exchange-pattern="request-response"
        address="http://localhost:8082/index.html" doc:name="HTTP" />
    <http:rest-service-component httpMethod="GET"
        serviceUrl="http://localhost:35798/RestServiceImpl.svc/json/567" />
    <object-to-string-transformer />
    <jdbc:outbound-endpoint exchange-pattern="one-way"
        queryKey="InsertRecord" queryTimeout="-1" connector-ref="PostgreSQL_Connector"
        doc:name="Database" />
</flow>

The #[message.payload] will contain the entire JSON string. What will come(regular expression or something else) in VALUES (?,?,?) to parse #[message.payload]?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:20:19+00:00Added an answer on June 18, 2026 at 4:20 pm

    From the MEL cheatsheet:

    MEL has no direct support for JSON. The json-to-object-transformer can
    turn a JSON payload into a hierarchy of simple data structures that
    are easily parsed with MEL.

    So use first to transform the JSON into datastructures (maps, lists):

    <json:json-to-object-transformer returnClass="java.lang.Object" />
    

    Then we extract the _itemList array:

    <expression-transformer
        expression='#[message.payload['AlertDetails']['_itemList']]" />
    

    Then we split this array in individual messages:

    <collection-splitter />
    

    From there the following expressions will evaluate to the desired values so they can be used in the insert query:

    #[message.payload.id]
    #[message.payload.severity]
    #[message.payload.occurred]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a REST API in java, and it supports responses that are
Say I have two functions that expect ...rest parameters private function a(...myParams):void { trace(myParams.length);
Say I have one form that changes its content (fields and options) based on
Is intercontainer communication possible within Apache tomcat? For example: Say you have 2 rest
Say I have a function foo: (defun foo (x y &rest args) ...) And
I have this 2D array (say double[10][10]) which contain some 1.0 and 10.0, rest
I want to display a yearly report based on month, let say I have
I have a variable that is increasing let's say from 0 to 99. Then
I am creating a Spring REST web service in java, that can be used
I have a site that is based on requests, users can request items, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.