Customer requested a specific JSON output of XML input by a JSONiq transformation in this developerWorks DataPower forum thread::
Some posting replies finally led to complete, working dynamic solution.
See outputs, code listings and explanations in this last posting:
HermannSW 2700006U54 Tags:  draft-04 draft-03 schema jsv json validation datapower 2 Comments 2,438 Views
DataPower firmware 6.0.0.x and 6.0.1.y implement draft-03.
Find a working draft-04 sample in this developerWorks DataPower forum posting (with 184.108.40.206 firmware):
Side-effect of request type JSON is creation of context __JSONASJSONX and conversion of input as JSONX.
220.127.116.11 service export attached to this posting has request type Non-XML and JSON parsing is done by JSONiq xfrom action doing store:///identity-json.xq.
As stated in other postings DataPower JSONiq (extensions to XQuery) implements version 0.4.42 of the spec:
In case you want to play with other 1.0 JSONiq implementation like http://try.zorba.io/ you find the differences post 0.4.42 here:
A "process JSON input sample" was posted here:
And this is JSONiq script groups.xq:
Earlier this month new JSON spec rfc7159.txt was published.
This seems to be the real big change between both specs:
HermannSW 2700006U54 Tags:  swa xslt datapower attachment mimswa rest soap mimetype.java swacurl json 2,284 Views
Customer raised question on developerWorks DataPower forum on how to convert client SOAP With Attachmnt (SWA) request on DataPower to REST. Yesterday's posting specifically raised the question on how to convert SWA to JSON-WSP attachment service request format.
Find the stylesheet doing the transformation, and how (simple) the attachments itself can be processed in my response:
The response attachment .zip contains sample service export, sample files and quite some useful tools for dealing with SWA files and DataPower. Besides the swa2json-wsp.xsl stylesheet these tools are useful for dealing with SWA files:
With these tools sending some attachments to DataPower SWA service is just two commands (see posting above for sample executions):
In developerWorks DataPower forum thread Need Help With XML to Json Transformation the question was raised on how to transform XML to JSON.
I did propose a transformation from XML to JSONX and then making use of "store:///jsonx2json.xsl" transformation to get the JSON output:
Pros of that approach:
I created "all-in-one" stylesheet for doing the XML-->JSON transformation rdp87.3.xsl:
Now I created two XML FW on a box with 18.104.22.168 firmware containing the (performance) fix for APAR IC90781 from May 2013 fixpack.
Finally I did:
Yes, the total time taken for rdp87.2.xsl (1961ms) in the templates is by a factor of 2.66 greater than that of rdp87.3.xsl (735ms).
But that does only make an effect if the whole operation of a service is just XML->JSON conversion.
If this is the case, then the (small) runtime overhead added is outweighted by maintainability and ease of stylesheet in my eyes.
This is the really small diff: