You can add a dependency to synapse-commons module and use the
org.apache.synapse.commons.json.JsonUtil class to access the JSON payload
within the mediate method (assuming that you are using ESB v4.8.*).
The utility class methods depend on the axis2 message context which you can
obtain from the synapse context.

Thanks,
Ishan.

On Tue, Feb 3, 2015 at 2:48 AM, Maz Lakadia <[email protected]> wrote:

> Hi,
>
> I am attempting to write a Custom Mediator using
> http://wso2.com/library/2898/ and http://wso2.com/library/2936/. However,
> these examples are for XML payloads. I am unsure how I could access the
> message payload within the mediate() method when the payload the JSON. Are
> there any available solutions which do not involve changing my JSON to XML
> and back (I cannot do that as my payload may be invalid XML, but it will
> always be valid JSON).
>
> Thank you,
>
> Maz
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Ishan Jayawardena
Senior Software Engineer
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to