Home | Printable Version
1.2.25: XML to JSON Conversion
The XML to JSON Conversion action is used to convert between XML content and equivalent JSON strings. This is often required during communication with REST based web services. The Source data to convert parameter indicates the location of the XML data that should be converted into JSON. The Location for JSON string parameter indicates where the generated JSON string should be placed. Any existing contents at this location will be replaced with the JSON string. If you do not wish to lose the existing XML structure during the conversion, make sure that this target location is in a different part of your FactBase to the source data. The Ignore Namespaces setting controls how XML namespace information is encoded into the JSON output. By default, @xmlns child properties will be included for any elements that define a new namespace, and any element or attribute names that are prefixed will remain prefixed in the resulting JSON. Alternatively, if this option is selected, all namespace information will be ignored, and any prefixed names will be output unprefixed. The final Convert element content only option controls what the root of the JSON fragment will be. By default, the JSON string will always contain a singe top level property for the element matched by the Source data to convert XPath. Instead, if this option is selected then the resulting JSON fragment will contain multiple top level properties, one for each of the children of the matched element. Screen-shot of an example XML to JSON Conversion action If you are performing this conversion in order to submit the JSON string to a web service, then you will likely want to place the JSON content into a <json_request> element, and then be sure to set a Content-Type header of application/json for the request. See the section on Rest Services for more details.
XML String JSON to XML Conversion