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.
Configure a JSON transformer
To configure a transformer, click the configuration button:
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:
JSON before the script
JSON after the script