title: How to apply regular expression on a JSON field to extract certain values from it and store into PostgreSQL Dataabse fron Mule Studio?
body: <p>Say I have a REST based service that returns a JSON object as under</p>
  
  <pre><code>{
      "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]"
                      }
                  ]
          }
  }
  </code></pre>
  
  <p>Now I have a table in PostgreSQL(say <em>testTable</em>) whose structure is as under</p>
  
  <pre><code>ID       (string)
  Severity (string)
  Occurred (string)
  </code></pre>
  
  <p>How can I parse those values from the available JSON field to insert the same into the PostgreSQL Database from Mule ESB studio.</p>
  
  <p>The final result in the testTable should be </p>
  
  <pre><code>ID                  Severity        Occured
  ---------           ---------       --------
  "badntp"            "warning"       "20121031T10:18:54"
  "updatesitefail"    "info"          "20121105T17:23:24"
  </code></pre>
  
  <p>My configuration file is as under</p>
  
  <pre><code>&lt;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" /&gt;
  
  &lt;jdbc:connector name="PostgreSQL_Connector" dataSource-ref="PostgreSQL_Data_Source"
      validateConnections="true" queryTimeout="-1" pollingFrequency="0"
      doc:name="Database"&gt;
      &lt;jdbc:query key="InsertRecord"
          value="INSERT INTO &amp;quot;testTable&amp;quot;(&amp;quot;ID&amp;quot;,&amp;quot;Severity&amp;quot;,&amp;quot;Occured&amp;quot;) VALUES (?,?,?)" /&gt;
  &lt;/jdbc:connector&gt;
  
  &lt;flow name="testRestFlow1" doc:name="testRestFlow1"&gt;
      &lt;http:inbound-endpoint exchange-pattern="request-response"
          address="http://localhost:8082/index.html" doc:name="HTTP" /&gt;
      &lt;http:rest-service-component httpMethod="GET"
          serviceUrl="http://localhost:35798/RestServiceImpl.svc/json/567" /&gt;
      &lt;object-to-string-transformer /&gt;
      &lt;jdbc:outbound-endpoint exchange-pattern="one-way"
          queryKey="InsertRecord" queryTimeout="-1" connector-ref="PostgreSQL_Connector"
          doc:name="Database" /&gt;
  &lt;/flow&gt;
  </code></pre>
  
  <p>The #[message.payload] will contain the entire JSON string. What will come(regular expression or something else) in <code>VALUES (?,?,?)</code> to parse   <code>#[message.payload]</code>?</p>
  
  <p>Thanks in advance</p>