JSON to XML in webMethods

Hi,

Please help me to understand how to convert a JSON content to xml by using webMethods.

I already placed json-lib-2.4-jdk15.jar in the IS.

Regards,
Santosh

not sure of any in-built apis in webMethods, however this should be easy with simple java. use json.xml.XMLSerializer class’ write(JSON json) method to convert the JSON to its xml value as string.
something like below.

XMLSerializer jsonxmlserializer = new XMLSerializer();
JSON jsonObj = JSONSerializer.toJSON( an object like input stream etc);
String xmlData = jsonxmlserializer .write(jsonObj);

-DC

1 Like

Hi,

IS can now handle JSON document in wM 9.5

Refer the below services:
pub.json:documentToJSONString
pub.json:jsonStreamToDocument
pub.json:jsonStringToDocument

For more information refer 9-5-SP1_Integration_Server_Built-In_Services_Reference.pdf

Hi,

I have a query regarding Json use in webMethods 9.9. We are migrating from webMethods 8.0 to webMethods 9.9. In webMethods 8.0 we are using Json but we use Json.jar.
When, we install webMethods 9.9, it should come with the Json inbuilt jars, but will these latest JARS be taking care of the older versions? Or we will have to copy older version of the jar as well to use the services as is in webMethods 9.9?

We want to re-use the older services we had as is in webMethods 9.9.
Please suggest.

Thanks,
Asmita

You can use the services from the new version after migration and test it rigorously before making it live. If you find issues with your older services SAG will not support it.

FYI: The support for JSon was implemented in webMethods 9.0 (uses Jackson Java libraries).