Export Database Table to JSON in Talend

In this section, we show how to use tFileOutputJSON to export the Database table to JSON in Talend with an example. For this Talend tFileOutputJSON demo, we are using the SQL Database table, and the data inside this table is

Customer Sales Table with HireDate

Talend Export Database Table to JSON File example

From the following image, you can see that we established a SQL connection. Within the tDBInput, we selected the Customer table.

Configure Server Connection and write table Select query

Drag and drop the tFileOutputJSON output field from the palette. As you can see from the tooltip, the Talend tFileOutputJSON creates a JSON structure from rows.

Export Database Table to JSON in Talend 2

Next, please connect the DBInput source to tFileOutputJSON. The following tFileOutputJSON image shows the list of options available in the Talend tFileOutputJSON component tab to export the database table to an Excel file. Please click on the Edit Schema button to check the tFileOutputJSON schema.

Edit Schema to Export Database Table to JSON in Talend

By default, the File name of the tFileOutputJSON output field selects the default location and out.json as the JSON file name. Please click the browse (…) button to choose the existing JSON file or create a new JSON file. Here, we are creating the jsonCustomers.json in the Output files directory. Let me check all the Talend tFileOutputJSON properties.

Export Database Table to JSON in Talend Configuration

Let me run this Talend export database table to JSON job.

Run the Job to Export Database Table to JSON in Talend

The below screenshot shows you the output. Let me expand the file for a better view.

Customers JSON File