Set up the tRowGenerator, tMap, tWriteJSONField, and the tLogRow components and add a field with a constant value in the tMap component.
Create a Standard Job with the following components:
- Connect the components using the connection.
- When prompted, add withloop as the output name.
- Select tMap and open the Map Editor.
Configure tmap as such:
- Ensure that you have added a new field with a constant value. In this scenario, use "x". Save your changes.
Select tWriteJSONField and configure the component with a looping element as placeholder.
Note: See for information about creating JSON elements that are of different types.
Edit the output schema for tWriteJSONField to have only
In the tWriteJSONField, access the . Click + to add loop to the Input column,
which then automatically populates the Output column with
- Select the Remove root node checkbox to prevent the root element from being output.
Run the Job to have an output with a single string JSON array. The following figure
shows the result generated with Number of Rows for
RowGenerator of the tRowGenerator component set to