JSON transformers

JSON transformers, rooted in JavaScript, provide the capability to manipulate the delivered JSON object. They can be employed to add, remove, and modify fields.

A JSON transformer, built with JavaScript, utilizes the entire data JSON object, allowing for manipulation to achieve any required structure. This involves:

  • Adding or removing fields
  • Modifying fields
  • Performing complex calculations

These transformations only impact the JSON file sent and do not affect the rendered report PDF file.

Add a JSON transformer

JSON transformers are configured on the report level, allowing each report to have its own transformer independent of the report template. To add a transformer, click the Add Transformer button, opening a form. Provide a name for the transformer and click Create. The transformer will then appear in the list.

JSONTransformers
JSON transformer list

Configure a JSON transformer

To open the configuring page of a transformer, click the configuration button:

JSONTransformerScript
JSON transformer text field

Put your executable script in the corresponding field.

JSON-Transformer example

The provided JavaScript code below demonstrates the mutation of the JSON file, adding a reportID field with the value of id:

JSONTransformerScriptExample
JSON transformer example

JSON before the script

JSONBeforeScript
JSON before transmutation

JSON after the script

JSONAfterScript
JSON after transmutation