Import JSON File into SQL Server Using SSIS

Script_Transformation_Editor5

In SQL Server Integration Services (SSIS), you can load data from a JSON file using the JSON Source component. Here are the steps to load a JSON file in SSIS:

Step 1: Create a new table in SQL Server

SSIS_createtable_
json_file_demo
Json file example (dummy data generated by AI)

Step 2: Create a new SSIS Package

Open SQL Server Data Tools (SSDT) or SQL Server Management Studio (SSMS) and create a new SSIS project or package.

Step 3: Add a Data Flow Task

Drag and drop a “Data Flow Task” from the SSIS Toolbox to the Control Flow canvas. 
Click “Data Flow Task” 

Step 4: Add JSON Source Component

  • Double-click on the Data Flow Task to go to the Data Flow tab.
  • Drag and drop a “JSON Source” component from the SSIS Toolbox to the Data Flow canvas.
  • Double-click the JSON Source component to configure it.

Step 5: Configure JSON Source Component

  1. In the JSON Source Editor, click on “New” under the Connection Manager section to create a new JSON connection manager.
  2. In the JSON Connection Manager Editor, provide the JSON file path or a variable that holds the file path.
  3. Click on “Columns” to specify the columns you want to extract from the JSON file. You can either manually define the columns or click on “Import From Sample” to automatically generate columns based on a sample JSON file.
  4. Click OK to close the editors.
Script_Transformation_Editor
Script_Transformation_Editor2
references_manager_setting1
Properties_Add_New_Item-class
create_new_class_main_cs
create_new_class1

Step 6: Add Destination Component

  1. After configuring the JSON Source component, drag and drop a destination component (e.g., OLE DB Destination, SQL Server Destination) to the Data Flow canvas.
  2. Connect the output of the JSON Source component to the input of the destination component.
  3. Configure the destination component to specify the destination table or file where you want to load the data.
OLE_DB_Destination_Editor1
OLE_DB_Destination_Editor2
Script_Component_OLE_DB_Destination

Step 7: Execute the SSIS Package

  1. Go back to the Control Flow tab.
  2. Configure any necessary control flow elements, such as error handling or logging.
  3. Execute the SSIS package to load data from the JSON file into the destination.
run_script_successfully

Step 8: Use SELECT statement to check loaded data the table

Make sure to validate and test your SSIS package thoroughly to ensure that the data is loaded correctly from the JSON file to the destination.

table_vew_after_load_file
table_vew_after_load_file_2

Leave a Reply