apache synapse custom mediator
===

I have a REST service that I want to use through wso2 ESB. The service returns a JSON object. I wish however to modify the JSON **before** it enters the ESB and gets processed.

I've managed to deploy a custom class mediator but I don't know how can I process the message body with it (the JSON object). Is this the right way to do this?

My service configuration looks like this at the moment:

    <proxy xmlns="http://ws.apache.org/ns/synapse" name="ListRm" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
       <target>
          <outSequence>
             <class name="org.mediator.MyMediator" />
             <send />
             <drop />
          </outSequence>
          <endpoint>
             <address uri="http://xx.xx.xxx.xx:8080/alfresco/s/slingshot/datalists/lists/site/rm/documentLibrary" />
          </endpoint>
       </target>
    </proxy>

Also is there some other way to modify the message body before it enters the ESB?