JSON transformers

JSON transformers allow manipulation of reports in JSON format before delivery.

JSON transformers are JavaScript functions that receive a report as a JSON object, enabling modifications to achieve any required structure. Typical use cases include:

  • Adding or removing fields
  • Modifying fields
  • Performing calculations

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

Add a JSON transformer

Add a transformer by clicking the Add Transformer button, which opens a form. Provide a name for the transformer, click Create, and it appears in the list.

JSON transformer list
JSON transformer list
JSON transformer list

Configure a JSON transformer

To configure a transformer, click the configuration button:

JSON transformer configuration
JSON transformer configuration
JSON transformer configuration

Insert the executable script in the corresponding field.

JSON transformer example

The example below shows how to mutate the JSON file by adding a reportID field with the value of id:

JSONTransformerScriptExample
JSON transformer example

JSON before the script

JSONBeforeScript
JSON before transformation

JSON after the script

JSONAfterScript
JSON after transformation