JSON transformers
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.
Configure a JSON transformer
To open the configuring page of a transformer, click the configuration button:
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
: