Edit online

Transforming JSON Documents with XQuery

There are several methods that can be used to transform JSON documents through XQuery processing.

Transforming a JSON Document Directly with XQuery

  1. Create a new transformation scenario using one of the following types of transformations:
    • JSON Transformation with XQueryJSON Transformation with XQuery - This scenario is useful if you want to develop a JSON document and the XQuery document is in its final form.
    • XQuery Transformation on JSONXQuery Transformation on JSON - This scenario is useful if you want to develop an XQuery document and the JSON document is in its final form.
  2. Configure the transformation scenario to suit your needs. In the XQuery tab, make sure you select the JSON file in the JSON URL field and the XQuery file in the XQuery URL field.
  3. Run the transformation.

Transforming Multiple JSON Documents at Once

It is also possible to transform multiple JSON documents at once with XQuery processing. To achieve this, select the JSON documents in the Project view, right-click, and apply or configure a transformation scenario.

Transforming a JSON Document Using XQuery

It is possible to transform JSON documents through XQuery processing.
  1. Create an XQuery file.
  2. Create a new XQuery transformation scenario for your XQuery file.
  3. Reference the JSON document that you want to transform using one of these two methods:
    • In the transformation scenario, click the Parameters button in the XQuery tab and add a parameter that specifies the URL to your JSON document in its value.
    • Specify the URL to your JSON document in the XQuery file you created.
  4. Run the transformation.
Tip:
There is a sample XQuery file in the [OXYGEN_INSTALL_DIR]/samples/json/transform folder that can be used to transform a JSON document.