I'm using ibm datapower to send a post request to an api. I'm using the url-open tag to send the post but I'm having trouble with the json payload. Ideally I'd like to do something like this:
<xsl:stylesheet xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx" version="1.0">
<dp:url-open target="{$url}">
<json:object>
<json:string name="key">value</json:string>
</json:object>
</dp:url-open>
</xsl:stylesheet>
but if I do it like this I'm getting an illegal char '{' error as the json isn't being stringified. If I do:
<xsl:variable name="payload">{"key": "value"}</xsl:variable>
<dp:url-open target="{$url}">
<xsl:value-of select="$payload" />
</dp:url-open>
It works as expected but it's not very dynamic as I have to hardcode the stringified object. Is there a way to create the json object as per the first example and then stringify before sending the request?
Any ideas greatly appreciated
C