SSIS Tip: Extracting JSON Data Stored in SQL Server Tables

Introduction

This guide will walk you through extracting and parsing JSON data stored in SQL Server tables using the JSON Parser Transform, available in the ZappySys SSIS PowerPack. Many applications store JSON strings in database columns to handle semi-structured data. With ZappySys, you can easily flatten and extract meaningful information from these columns within your SSIS workflows.

Prerequisites

Steps

Step 1: Create a Sample Table with JSON Data

Let’s assume you have a SQL Server table structured like this:

CREATE TABLE dbo.JsonDataExample (
    Id INT IDENTITY(1,1) PRIMARY KEY,
    Data NVARCHAR(MAX) -- This column holds the JSON string
);

INSERT INTO dbo.JsonDataExample (Data)
VALUES
(N'{"employee":[{"name": "Alice", "age": 30, "city": "La Paz"}]}'),
(N'{"employee":[{"name": "Bob", "age": 25, "city": "Santa Cruz"}]}'),
(N'{"employee":[{"name": "Alex", "age": 29, "city": "Cochabamba"}]}'),
(N'{"employee":[{"name": "Daniel", "age": 25, "city": "Tarija"}]}');

Step 2: Read the Data from SQL Server

  1. Add a Data Flow Task to the Control Flow.

  2. Inside the Data Flow, drag an OLE DB Source.

  3. Select the table and connect to your SQL Server database. You can preview the data to verify the output.

  4. Connect a JSON Parser Transform to the OLE DB Source.

  5. In the parser, select the column containing the JSON data (Data) and provide a sample JSON to help the component auto-detect the structure.

  6. Use the array filter (e.g., $.employee[*]) to extract the desired object or array.

  7. Click Preview to validate the transformation, then click OK to save the configuration.

  8. Connect the parser to a destination component (in this case, Trash destination) to see the parsed output. Run the package to view the results — JSON fields will now appear as columns.

Considerations

  • Ensure the JSON structure is consistent across all rows. For inconsistent or malformed data, refer to this error handling guide.

Video Tutorial

Conclusion

Using ZappySys JSON Parser Transform, parsing JSON stored in SQL Server with SSIS becomes straightforward and efficient. This method eliminates the need for complex T-SQL JSON functions or custom scripts. Quickly integrate structured JSON data into your ETL workflows with just a few clicks.

For more advanced file, API, and cloud integrations, explore the full capabilities of the ZappySys SSIS PowerPack.

References

Contact Us

If you have questions or specific use-cases, feel free to reach out to our support team via live chat or submit a ticket.