Home > JSON, SQL Server 2016 > Import/Read a JSON string and convert it in tabular (row/column) form | SQL Server 2016 – Part 2

Import/Read a JSON string and convert it in tabular (row/column) form | SQL Server 2016 – Part 2

October 30, 2015 Leave a comment Go to comments

In my [previous post] I discussed on how to format/convert any Query/Table data to a string in JSON format. JSON in SQL Server was limited to this feature only till the CTP 2 version.

But now with the CTP 3 release you can do reverse of it also, means now you can read back JSON data and convert it to tabular or row & column format.

Let’s check this by taking same sample data from our previous JSON-Export post.

SELECT @json = N'{"StudList":

SELECT ID, FirstName, LastName, Class, Marks
FROM OPENJSON (@json, '$.StudList')
	FirstName VARCHAR(255), 
	LastName VARCHAR(255), 
	Class INT,
	Marks DECIMAL(3,1)
) AS StudList

– Output:
SQL Server 2016 - JSON export 01

Well, that was simple, isn’t it!!!


In my [next post] I’ll talk about Nested Properties in a JSON string with single and multiple elements.

  1. October 30, 2015 at 7:03 am

    Now this was much needed info. Ample times we recieve data in json format especially from webapi .

  2. Rani
    January 5, 2018 at 9:57 pm

    Hi Manoj,

    We are using SQL Server 2012 version database. Could you please guide me the best way to convert Json data into SQL Server?


  1. October 30, 2015 at 11:49 am
  2. November 1, 2015 at 7:03 am
  3. November 2, 2015 at 7:01 am
  4. January 5, 2017 at 12:04 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: