Introducing JSON for SQL Server 2016

By:   |   Updated: 2015-09-08   |   Comments (7)   |   Related: > SQL Server 2016


Problem

On my current project, there is a requirement to extract data, which is stored in one database (D1) and load it into another database (D2). That should be simple, right? But, the client is not ready to give access to the D2 database due to confidential data. We have to push data to the D2 database via the REST API which accepts JSON as an input.

We are trying to find an option to convert the data into JSON format at the database level. Unfortunately, SQL Server does not support converting data into JSON format. To resolve this issue, we developed a .NET utility to convert the data to JSON format with the help of the “JavaScriptSerializer” class then pushed the data to the D2 database via REST API

I see SQL Server 2016 now supports JSON. Is it possible to replace our .NET utility? In this tip, we will demonstrate how use JSON in SQL Server 2016.

Solution

JSON support in SQL Server is one of the highly ranked requests in Connect #673824, which received 1000+ votes.

What is JSON?

  • JSON stands for JavaScript Object Notation
  • JSON is mainly used to store and exchange information
  • JSON data is well organized, easy-to-access and in human-readable format of data that can be accessed in a logical manner
  • JSON is self-describing and easy to understand
  • JSON is a lightweight data-interchange format
  • JSON is language independent
  • JSON is used primarily to transmit data between a server and web application, as an alternative to XML

Sample JSON Format

JSON data will look like the below example:

Sample JSON Data

The sample JSON code snipped above is from http://json.org/example.

Why JSON in SQL Server?

Most of the major databases are adopting JSON support because the usage of JSON in Web APIs has increased significantly. SQL Server 2016 also enabled JSON support for the lingua franca* of web applications in addition to supporting direct querying to Hadoop. JSON functionality in SQL Server is similar to XML Support.

*Lingua Franca: A Language that is adopted as a common language between speakers whose native languages are different. Referred from dictionary.reference.com/browse/lingua+franca

JSON Functionality in SQL Server

JSON features that are planned in SQL Server 2016…

  • SQL SERVER CTP2 – Format and export the data in JSON Format
  • SQL SERVER CTP3 – Extract and Load the JSON into Tables, seeking values from JSON text, index the column which has JSON data, etc.

JSON Features in CTP2

For JSON [AUTO | PATH] – We can get the JSON output by adding the “For JSON” clause in a SELECT statement. We can generate the JSON in two different modes, we will look at each option in the below sections.

JSON Functionality Expected in CTP3

The features listed below are expected to be available as part of CTP3:

Reference: http://blogs.msdn.com/b/jocapc/archive/2015/05/16/json-support-in-sql-server-2016.aspx

  • OPENJSON - OPENJSON is a table-value function, which accepts some text which includes a JSON value and returns rows in the required format. FOR JSON, converts the rows into JSON format, but OPENJSON will convert back the JSON text into a table of rows.
  • IsJSON (< JSON text >) - This function verifies, whether the given text is formatted according to JSON standards/rules.
  • JSON_Value () - This is a scalar function and it parses the JSON text then extracts a value if it exists in the path arguments. This functionality is similar to XPATH (XML Path) which is used for selecting nodes from XML text. In addition, XPath may be used to compute values (e.g. strings, numbers or Boolean values) from the content of an XML document.

JSON in SQL Server

  • To store JSON data in SQL Server, we have to use an NVARCHAR datatype because there is no separate datatype for JSON data.
  • NVARCHAR supports the storage of most of the data types and now is extended to handle JSON as well.

Sample SQL with JSON

If you are familiar with the FOR XML clause in SQL Server, then you can pick up the FOR JSON syntax very easily because it can be used in the similar way. JSON can be generated in 2 different modes (AUTO and PATH). Refer to the samples below.

FOR JSON AUTO – JSON objects are created automatically based on the table used in the T-SQL statements. This functionality is similar to the FOR XML AUTO command.

Sample FOR JSON AUTO QUERY

USE AdventureWorks2014
GO
SELECT 
	TOP 3 
        BusinessEntityID AS 'PersonID',
        FirstName AS 'FirstName', 
        MiddleName AS 'MiddleName', 
        LastName AS 'LastName'
FROM 
        [Person].[Person] 
FOR 
        JSON AUTO
        

SQL RESULT

[{"PersonID":285,"FirstName":"Syed","MiddleName":"E","LastName":"Abbas"},
{"PersonID":293,"FirstName":"Catherine","MiddleName":"R.","LastName":"Abel"},
{"PersonID":295,"FirstName":"Kim","LastName":"Abercrombie"}]

FOR JSON AUTO Output

FOR JSON PATH – We can define the JSON structure in the query by defining column alias with a dot (.) separated value (for example ‘Root.level1’). This Functionality is similar to FOR XML PATH.

Sample FOR JSON PATH QUERY

USE AdventureWorks2014
GO
SELECT 
    TOP 3
       BusinessEntityID AS 'Persons.PersonID',
       FirstName AS 'Persons.FirstName',
       MiddleName AS 'Persons.MiddleName',
       LastName AS 'Persons.LastName'
FROM
       [Person].[Person]
FOR
       JSON PATH
       

SQL RESULT

[
{"Persons":{"PersonID":285,"FirstName":"Syed","MiddleName":"E","LastName":"Abbas"}},
{"Persons":{"PersonID":293,"FirstName":"Catherine","MiddleName":"R.","LastName":"Abel"}},
{"Persons":{"PersonID":295,"FirstName":"Kim","LastName":"Abercrombie"}}]

FOR JSON AUTO Output

Next Steps
  • With JSON support available in SQL Server 2016 begin to start learning more about the technology and consider opportunities to implement it in your environment.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Babu Akkandi Babu Akkandi is a BI Professional and has 11+ years of experience in the IT industry and has been working with SQL Server since version 7.0.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2015-09-08

Comments For This Article




Thursday, April 5, 2018 - 7:19:19 AM - chandana Back To Top (75615)

 

 HI, 

I have Org data in sql server. when I am trying to convert it to json format it is showing error message like "Unable to show XML". I increased the size of XML data to Unlimited in SQL Server results to grid.

Even though I couldnt able to open the xml file.

Can you please help me?

Thanks in advance.

 


Thursday, May 11, 2017 - 8:54:31 PM - jerry john Back To Top (55684)

Hi,

 

I have a json text in sql server. i woul like to know how to write select query for the below code .

bit confused how can we select @baseRate ,@amount..  all variables starting with @

 

{"HotelItineraryResponse":{"@size":"1","customerSessionId":"0AB28636-2CD6-4915-BF42-27360D9065D4","Itinerary":{"itineraryId":278985747,"affiliateId":489808,"creationDate":"01\/31\/2017","creationTime":"22:10:17 CST","itineraryStartDate":"07\/10\/2017","itineraryEndDate":"07\/17\/2017","affiliateCustomerId":"036686","Customer":{"email":"[email protected]","firstName":"Melissa","lastName":"Rodger","homePhone":"0010401162767","workPhone":"0010401162767","CustomerAddresses":{"address1":"123 Fake Road","city":"San Francisco","stateProvinceCode":"CA","countryCode":"US","postalCode":83715,"isPrimary":true,"type":1}},"HotelConfirmation":{"supplierId":13,"chainCode":"EP","arrivalDate":"07\/10\/2017","departureDate":"07\/17\/2017","confirmationNumber":135507880191,"RateInfos":{"@size":"1","RateInfo":{"@priceBreakdown":"true","@promo":"false","@rateChange":"false","ChargeableRateInfo":{"@averageBaseRate":"97.23","@averageRate":"97.23","@commissionableUsdTotal":"505.13","@currencyCode":"AUD","@maxNightlyRate":"97.23","@nightlyRateTotal":"680.61","@surchargeTotal":"127.12","@total":"807.73","NightlyRatesPerRoom":{"@size":"7","NightlyRate":{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"}},"Surcharges":{"@size":"1","Surcharge":{"@type":"TaxAndServiceFee","@amount":"127.12"}}},"cancellationPolicy":"This rate is non-refundable and cannot be changed or cancelled - if you do choose to change or cancel this booking you will not be refunded any of the payment.","nonRefundable":true,"online":true,"rateType":"MerchantPackage"}},"numberOfAdults":2,"numberOfChildren":0,"affiliateConfirmationId":"210108-0-flightcentreltd-0","smokingPreference":"N","supplierPropertyId":5405401,"roomTypeCode":200211986,"rateCode":208195741,"rateDescription":"Book now and save","roomDescription":"Deluxe Room","status":"CF","locale":"en_US","GenericRefund":{"refundAmount":"0.00","currencyCode":"USD"},"ReservationGuest":{"firstName":"Melissa","lastName":"Rodger"},"Hotel":{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},"ConfirmationExtras":{"@size":"2","ConfirmationExtra":{"@name":"ADDITIONAL_DATA_1","@value":"210108"},{"@name":"ADDITIONAL_DATA_2","@value":"557500"}},"nights":7},{"supplierId":13,"chainCode":"EP","arrivalDate":"07\/10\/2017","departureDate":"07\/17\/2017","confirmationNumber":"135507880191-1","RateInfos":{"@size":"1","RateInfo":{"@priceBreakdown":"true","@promo":"false","@rateChange":"false","ChargeableRateInfo":{"@averageBaseRate":"74.95","@averageRate":"74.95","@commissionableUsdTotal":"389.38","@currencyCode":"AUD","@maxNightlyRate":"74.95","@nightlyRateTotal":"524.65","@surchargeTotal":"98.00","@total":"622.65","NightlyRatesPerRoom":{"@size":"7","NightlyRate":{"@baseRate":"74.95","@rate":"74.95","@promo":"false"},{"@baseRate":"74.95","@rate":"74.95","@promo":"false"},{"@baseRate":"74.95","@rate":"74.95","@promo":"false"},{"@baseRate":"74.95","@rate":"74.95","@promo":"false"},{"@baseRate":"74.95","@rate":"74.95","@promo":"false"},{"@baseRate":"74.95","@rate":"74.95","@promo":"false"},{"@baseRate":"74.95","@rate":"74.95","@promo":"false"}},"Surcharges":{"@size":"1","Surcharge":{"@type":"TaxAndServiceFee","@amount":"98.00"}}},"cancellationPolicy":"This rate is non-refundable and cannot be changed or cancelled - if you do choose to change or cancel this booking you will not be refunded any of the payment.","nonRefundable":true,"online":true,"rateType":"MerchantPackage"}},"numberOfAdults":2,"numberOfChildren":0,"affiliateConfirmationId":"210108-0-flightcentreltd-0","smokingPreference":"N","supplierPropertyId":5405401,"roomTypeCode":200211986,"rateCode":208195741,"rateDescription":"Last minute deal","roomDescription":"Deluxe Room","status":"CF","locale":"en_US","GenericRefund":{"refundAmount":"0.00","currencyCode":"USD"},"ReservationGuest":{"firstName":"Melissa","lastName":"Rodger"},"Hotel":{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},"ConfirmationExtras":{"@size":"2","ConfirmationExtra":{"@name":"ADDITIONAL_DATA_1","@value":"210108"},{"@name":"ADDITIONAL_DATA_2","@value":"557500"}},"nights":7},{"supplierId":13,"chainCode":"EP","arrivalDate":"07\/10\/2017","departureDate":"07\/17\/2017","confirmationNumber":"135507880191-2","RateInfos":{"@size":"1","RateInfo":{"@priceBreakdown":"true","@promo":"false","@rateChange":"false","ChargeableRateInfo":{"@averageBaseRate":"97.23","@averageRate":"97.23","@commissionableUsdTotal":"505.13","@currencyCode":"AUD","@maxNightlyRate":"97.23","@nightlyRateTotal":"680.61","@surchargeTotal":"127.12","@total":"807.73","NightlyRatesPerRoom":{"@size":"7","NightlyRate":{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"},{"@baseRate":"97.23","@rate":"97.23","@promo":"false"}},"Surcharges":{"@size":"1","Surcharge":{"@type":"TaxAndServiceFee","@amount":"127.12"}}},"cancellationPolicy":"This rate is non-refundable and cannot be changed or cancelled - if you do choose to change or cancel this booking you will not be refunded any of the payment.","nonRefundable":true,"online":true,"rateType":"MerchantPackage"}},"numberOfAdults":1,"numberOfChildren":0,"affiliateConfirmationId":"210108-0-flightcentreltd-0","smokingPreference":"N","supplierPropertyId":5405401,"roomTypeCode":200211986,"rateCode":208195741,"rateDescription":"Book now and save","roomDescription":"Deluxe Room","status":"CF","locale":"en_US","GenericRefund":{"refundAmount":"0.00","currencyCode":"USD"},"ReservationGuest":{"firstName":"Melissa","lastName":"Rodger"},"Hotel":{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},{"hotelId":418743,"statusCode":"A","name":"Hotel Kumala Pantai","address1":"Jl. Werkudara","city":"Legian","countryCode":"ID","postalCode":80361,"phone":"62-361-755500","fax":"62-361-755700","latitude":-8.69873,"longitude":115.16501,"coordinateAccuracyCode":0,"lowRate":108.4756,"highRate":433.9054,"confidence":52,"hotelRating":3.5,"tripAdvisorRating":4.0,"theme":"Business Hotel, Family Hotel","specialCheckInInstructions":"Guests booked in the \"Domestic Rate\" category must provide Indonesian identification or a KITAS card at check-in. The hotel reserves the right to amend the room rate to full price if valid proof is not provided.  In accordance with local regulations, all visitors must remain within the hotel property during Seclusion Day\/Hindu New Year on March 17, 2018 (from midnight March 16, 2018 to early morning March 18, 2018). Check-in and check-out will not be possible on March 17, 2018. For more details, please contact the office using the information on the reservation confirmation received after booking."},"ConfirmationExtras":{"@size":"2","ConfirmationExtra":{"@name":"ADDITIONAL_DATA_1","@value":"210108"},{"@name":"ADDITIONAL_DATA_2","@value":"557500"}},"nights":7}}}}

 

 

******************

 

below select query im using ..but not giving the whole data

 

DECLARE @json NVARCHAR(MAX)= (select * from tb  )

 

SELECT *

FROM OPENJSON(@json)

 

 

 

WITH (   

              itineraryId   varchar(200) '$.HotelItineraryResponse.Itinerary.itineraryId' ,

 firstName      varchar(50) '$.HotelItineraryResponse.Itinerary.Customer.firstName',

 LastName      varchar(50) '$.HotelItineraryResponse.Itinerary.Customer.lastName',

 Email      varchar(50) '$.HotelItineraryResponse.Itinerary.Customer.email',

 arrivalDate     date '$.HotelItineraryResponse.Itinerary.HotelConfirmation[0].arrivalDate',

 departureDate     date '$.HotelItineraryResponse.Itinerary.HotelConfirmation[0].departureDate',

 --supplierId      varchar(50) '$.HotelItineraryResponse.Itinerary.HotelConfirmation.supplierId',

 --priceBreakdown      nvarchar(max) '$.HotelItineraryResponse.Itinerary.HotelConfirmation.RateInfos.RateInfo.priceBreakdown',

 cancellationPolicy nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.RateInfos.RateInfo[0].cancellationPolicy',

 averageRate nvarchar(50)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.RateInfos.RateInfo.ChargeableRateInfo[1].averageRate',

 total money  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.RateInfos.RateInfo.ChargeableRateInfo.total',

 surchargeTotal money  '$.HotelItineraryResponseItinerary.HotelConfirmation.RateInfos.RateInfo.ChargeableRateInfo.surchargeTotal',

 roomDescription nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.roomDescription',

 phone nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel.phone',

 name nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel.name',

 [address] nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel.address1',

 city nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel.city',

 stateProvinceCode nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel[0].stateProvinceCode',

 countryCode nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel.countryCode',

 nights int  '$.HotelItineraryResponse.Itinerary.HotelConfirmation[0].nights',

 numberOfChildren int  '$.HotelItineraryResponse.Itinerary.HotelConfirmation[0].numberOfChildren',

     numberOfAdults int  '$.HotelItineraryResponse.Itinerary.HotelConfirmation[0].numberOfAdults',

 specialCheckInInstructions nvarchar(max)  '$.HotelItineraryResponse.Itinerary.HotelConfirmation.Hotel.specialCheckInInstructions'

 

            

 ) 

 


Friday, December 2, 2016 - 1:31:03 AM - ravindar Back To Top (44880)

 

 Great article! It is very useful information.  Thanks!!


Wednesday, June 8, 2016 - 4:12:53 PM - Harold Scott Back To Top (41644)

Great article! I am working on an executive overview that I need to present to my manager, can anybody point me to some other high-level discussions on this topic, I'm not a great writer (except when it comes to code :)) and I would like to see how some people describe it in a way that's easy for non-technical folks ... Thanks


Wednesday, September 9, 2015 - 3:33:34 AM - Babu Akkandi Back To Top (38618)

@Gourisankar, Thanks for your comments!

@kesavaram, Yes, you are right, We did Lot of workaround in .NET while converting the data to JSON Format. SQL 2016 made it with simple approach. Thanks for you comments!


Tuesday, September 8, 2015 - 3:48:34 AM - kesavaram s Back To Top (38610)

Very useful information, with the keyword JSON PATH being intorduced in sql server 2016 will reduce the time which puts in lot of efforts to develop a .NET utility.

Thanks Babu Akkandi.


Tuesday, September 8, 2015 - 3:32:01 AM - Gourisankar Back To Top (38609)

Nice Article, Thanks Babu ..!

Keep posting such valuable information.















get free sql tips
agree to terms