Solved

Parse Json structure using SSIS and load into table in sql server

Posted on 2013-06-04
2
1,972 Views
Last Modified: 2016-02-11
I have a table with a column which has data in JSON format

Example:
{"id":0,"name":null,"type":"Address","value":"\"02421\"","count":0}

I need to parse this and store the values in different columns in sql server using SSIS.

Can you please give some suggestions for parsing json structure using SSIS
0
Comment
Question by:MRPT
2 Comments
 
LVL 16

Accepted Solution

by:
DcpKing earned 500 total points
ID: 39221015
How do you parse it yourself?
Well, you start at a { and end at a }
Inside that there's a number of name-value pairs - here there are
          "id":0,"name":null,"type":"Address","value":"\"02421\"","count":0
which come out as
          "id":0,
          "name":null,
          "type":"Address",
          "value":"\"02421\"",
          "count":0
So you see that each data element (name-value pair) has a name (withing quotes), a colon, the value, and a comma (or the finishing brace). A value can be just what it is, or a string in quotes, and you'll have to cope with the escaped internal quote, but that won't be too hard.

I'd suggest that you write code to fill a table of three columns (first being an identity col to retain the sequence) and then fill your storage table.

hth

Mike
0
 

Author Closing Comment

by:MRPT
ID: 39285344
Thank You
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now