{"id":4124,"date":"2015-11-15T23:39:11","date_gmt":"2015-11-15T18:09:11","guid":{"rendered":"http:\/\/sqlhints.com\/?p=4124"},"modified":"2015-12-23T07:37:25","modified_gmt":"2015-12-23T02:07:25","slug":"json_query-function-in-sql-server-2016","status":"publish","type":"post","link":"https:\/\/sqlhints.com\/2015\/11\/15\/json_query-function-in-sql-server-2016\/","title":{"rendered":"JSON_QUERY Function in Sql Server 2016"},"content":{"rendered":"<p style=\"text-align: justify;\"><strong>JSON_QUERY<\/strong> is one of the new JSON function introduced in Sql Server 2016 to query the JSON data. JSON_QUERY basically returns the JSON fragment (i.e. JSON object or an array) from the input JSON string from the specified JSON path.<\/p>\n<p><strong>SYNTAX:<\/strong><\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nJSON_QUERY ( json_string,  json_path )\r\n<\/pre>\n<p><strong>WHERE:<\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>json_string <\/strong>is the JSON string from which the JSON fragment will be extracted.<\/p>\n<p style=\"text-align: justify;\"><strong>json_path <\/strong>is the location of the JSON string in the json_string. Within json_path we can specify the path mode, it can be lax or strict. Lax is the default path mode, if json_path is invalid (i.e. it is not present in the json_string) then it returns null, but if path mode is strict it will raise an error.<\/p>\n<p style=\"text-align: justify;\">This function will return error even in the scenario if the specified json_path is resulting in a scalar value other than the JSON object or array. Where as <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_value-function-in-sql-server-2016\/\" target=\"_blank\">JSON_VALUE<\/a> works the other way, it returns an error in case the JSON path is <\/p>\n<p><strong>[ALSO READ]:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/10\/25\/json-in-sql-server-2016\/\" target=\"_blank\">Native JSON Support in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/for-json-clause-in-sql-server-2016\/\" target=\"_blank\">FOR JSON Clause in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/22\/openjson-function-in-sql-server-2016\/\" target=\"_blank\">OPENJSON Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/isjson-function-in-sql-server-2016\/\" target=\"_blank\">ISJSON Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_value-function-in-sql-server-2016\/\" target=\"_blank\">JSON_VALUE Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/lax-and-strict-json-path-modes-in-sql-server-2016\/\" target=\"_blank\">lax and strict JSON Path modes in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/28\/indexing-strategy-for-json-value-in-sql-server-2016\/\" target=\"_blank\">Indexing Strategy for JSON Value in Sql Server 2016<\/a><\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Let us understand JSON_QUERY function with extensive list of examples:<\/p>\n<p style=\"text-align: justify;\"><strong>Example 1:<\/strong> In this example let us try to get the Hobbies array using the JSON_QUERY function<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_QUERY(@json_str,&#039;$.Hobbies&#039;) Hobbies<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-1-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-1-1.jpg\" alt=\"JSON_QUERY Sql Example 1 1\" width=\"550\" height=\"243\" class=\"alignnone size-full wp-image-4131\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Here in the json_path the $ symbol implies the json_string and $. Hobbies means Hobbies property in the json_string at the root level.<\/p>\n<p style=\"text-align: justify;\">Let us try doing the same using the JSON_VALUE function<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_VALUE(@json_str,&#039;$.Hobbies&#039;) Hobbies\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-1-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-1-2.jpg\" alt=\"JSON_QUERY Sql Example 1 2\" width=\"550\" height=\"206\" class=\"alignnone size-full wp-image-4132\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-1-2.jpg 549w, https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-1-2-300x113.jpg 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">From the result it is clear that JSON_VALUE function is not for reading the JSON object or array, instead it is for reading the scalar JSON values like string, integer etc.<\/p>\n<p style=\"text-align: justify;\"><strong>Example 2:<\/strong> Try to get the complete JSON string from the root<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\n--Get customer details\r\nSELECT JSON_QUERY(@json_str,&#039;$&#039;) JSON\r\nGO<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-2.jpg\" alt=\"JSON_QUERY Sql Example 2\" width=\"481\" height=\"288\" class=\"alignnone size-full wp-image-4133\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-2.jpg 481w, https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-2-300x180.jpg 300w\" sizes=\"auto, (max-width: 481px) 100vw, 481px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><strong>Example 3:<\/strong> Try to get a JSON scalar value (i.e. non-JSON object or array)<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_QUERY(@json_str,&#039;$.Name&#039;) Name<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-3.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-3.jpg\" alt=\"JSON_QUERY Sql Example 3\" width=\"490\" height=\"206\" class=\"alignnone size-full wp-image-4134\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-3.jpg 490w, https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-3-300x126.jpg 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/a><br \/>\n<strong>[ALSO READ]:<a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/lax-and-strict-json-path-modes-in-sql-server-2016\/\" target=\"_blank\">lax and strict JSON Path modes in Sql Server 2016<\/a><\/strong><br \/>\n<strong>Example 4:<\/strong> <strong>lax <\/strong>and <strong>strict <\/strong>JSON path modes in JSON_QUERY<\/p>\n<p style=\"text-align: justify;\">Let us try to re-execute the example 3 by setting the JSON path mode as strict<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_QUERY(@json_str,&#039;strict$.Name&#039;) Name<\/pre>\n<p><strong>RESULT:<\/strong><\/p>\n<p style=\"text-align: justify;color: red;\">\nMsg 13608, Level 16, State 2, Line 4<br \/>\nProperty cannot be found in specified path.\n<\/p>\n<p style=\"text-align: justify;\">Let us try executing the above query by explicitly specifying the default JSON path mode <strong>lax<\/strong><\/p>\n<pre class=\"brush: sql; gutter: false\">DECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_QUERY(@json_str,&#039;lax$.Name&#039;) Name<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-4-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-4-2.jpg\" alt=\"JSON_QUERY Sql Example 4 2\" width=\"522\" height=\"215\" class=\"alignnone size-full wp-image-4135\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-4-2.jpg 522w, https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-4-2-300x124.jpg 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/a><br \/>\n<strong>Example 5:<\/strong> In this example try to read on of the array element which in-turn is not a JSON object or an array<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_QUERY(@json_str,&#039;$.Hobbies[1]&#039;) Hobby<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-5-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-5-1.jpg\" alt=\"JSON_QUERY Sql Example 5 1\" width=\"550\" height=\"215\" class=\"alignnone size-full wp-image-4136\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Try to execute the above query using the JSON_VALUE function instead of JSON_QUERY function<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t&quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;\r\nSELECT JSON_VALUE(@json_str,&#039;$.Hobbies[1]&#039;) Hobby<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-5-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-5-2.jpg\" alt=\"JSON_QUERY Sql Example 5 2\" width=\"550\" height=\"215\" class=\"alignnone size-full wp-image-4137\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">From these examples it is clear that we can use the JSON_QUERY function to extract a JSON object or an array only, but not for the scalar values like string, integer etc.<\/p>\n<p style=\"text-align: justify;\"><strong>Example 6:<\/strong> Try to extract complete JSON from the JSON string<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Customers&quot;:\r\n\t[{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t  &quot;Address&quot;:{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}},\r\n\t {&quot;Id&quot;:2,&quot;Name&quot;:&quot;Kalpana&quot;,\r\n\t  &quot;Address&quot;:{&quot;State&quot;:&quot;NY&quot;,&quot;Country&quot;:&quot;United State&quot;}}\r\n\t]\r\n }&#039;\r\n SELECT JSON_QUERY(@json_str,&#039;$&#039;) CompleteJSON\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-6.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-6.jpg\" alt=\"JSON_QUERY Sql Example 6\" width=\"641\" height=\"503\" class=\"alignnone size-full wp-image-4139\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-6.jpg 641w, https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-6-300x235.jpg 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/a>\t<\/p>\n<p style=\"text-align: justify;\"><strong>Example 7:<\/strong> In this example try to extract the Customers array<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Customers&quot;:\r\n\t[{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t\t&quot;Address&quot;:{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}},\r\n\t {&quot;Id&quot;:2,&quot;Name&quot;:&quot;Kalpana&quot;,\r\n\t\t\t&quot;Address&quot;:{&quot;State&quot;:&quot;NY&quot;,&quot;Country&quot;:&quot;United State&quot;}}\r\n\t]\r\n }&#039;\r\n SELECT JSON_QUERY(@json_str,&#039;$.Customers&#039;) CustomersArray\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-7.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-7.jpg\" alt=\"JSON_QUERY Sql Example 7\" width=\"662\" height=\"449\" class=\"alignnone size-full wp-image-4138\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-7.jpg 662w, https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-7-300x203.jpg 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><strong>Example 8:<\/strong> In this example extract the first customer JSON object<\/P> <\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Customers&quot;:\r\n\t[{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t\t&quot;Address&quot;:{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}},\r\n\t {&quot;Id&quot;:2,&quot;Name&quot;:&quot;Kalpana&quot;,\r\n\t\t\t&quot;Address&quot;:{&quot;State&quot;:&quot;NY&quot;,&quot;Country&quot;:&quot;United State&quot;}}\r\n\t]\r\n }&#039;\r\n SELECT JSON_QUERY(@json_str,&#039;$.Customers[0]&#039;) CustomerObject\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-8.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-8.jpg\" alt=\"JSON_QUERY Sql Example 8\" width=\"550\" height=\"382\" class=\"alignnone size-full wp-image-4140\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><strong>Example 9:<\/strong> In this example try to extract the first customer\u2019s address object<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_str NVARCHAR(MAX) = \r\n &#039;{&quot;Customers&quot;:\r\n\t[{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n\t\t\t&quot;Address&quot;:{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}},\r\n\t {&quot;Id&quot;:2,&quot;Name&quot;:&quot;Kalpana&quot;,\r\n\t\t\t&quot;Address&quot;:{&quot;State&quot;:&quot;NY&quot;,&quot;Country&quot;:&quot;United State&quot;}}\r\n\t]\r\n }&#039;\r\n SELECT JSON_QUERY(@json_str,&#039;$.Customers[0].Address&#039;) AddressObject\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-9.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2015\/11\/JSON_QUERY-Sql-Example-9.jpg\" alt=\"JSON_QUERY Sql Example 9\" width=\"550\" height=\"360\" class=\"alignnone size-full wp-image-4141\" \/><\/a><\/p>\n<p><strong>[ALSO READ]:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/10\/25\/json-in-sql-server-2016\/\" target=\"_blank\">Native JSON Support in Sql Server 2016<\/a>\n<ul>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/for-json-clause-in-sql-server-2016\/\" target=\"_blank\">FOR JSON Clause in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/22\/openjson-function-in-sql-server-2016\/\" target=\"_blank\">OPENJSON Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/isjson-function-in-sql-server-2016\/\" target=\"_blank\">ISJSON Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_value-function-in-sql-server-2016\/\" target=\"_blank\">JSON_VALUE Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_query-function-in-sql-server-2016\/\" target=\"_blank\">JSON_QUERY Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/lax-and-strict-json-path-modes-in-sql-server-2016\/\" target=\"_blank\">lax and strict JSON Path modes in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/28\/indexing-strategy-for-json-value-in-sql-server-2016\/\" target=\"_blank\">Indexing Strategy for JSON Value in Sql Server 2016<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/12\/drop-if-exists-statement-in-sql-server-2016\/\" target=\"_blank\">DROP IF EXISTS Statement in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/29\/compare-execution-plan-in-sql-server-2016\/\" target=\"_blank\">Compare Execution Plans in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/11\/live-query-statistics-in-sql-server-2016\/\" target=\"_blank\">Live Query Statistics in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/12\/datediff_big-function-in-sql-server-2016\/\" target=\"_blank\">DATEDIFF_BIG Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/12\/difference-between-datediff-and-datediff_big-functions-in-sql-server\/\" target=\"_blank\">Difference between DATEDIFF and DATEDIFF_BIG functions in Sql Server<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/15\/session_context-in-sql-server-2016\/\" target=\"_blank\">SESSION_CONTEXT in Sql Server 2016<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>JSON_QUERY is one of the new JSON function introduced in Sql Server 2016 to query the JSON data. JSON_QUERY basically returns the JSON fragment (i.e. JSON object or an array) from the input JSON string from the specified JSON path. SYNTAX: JSON_QUERY ( json_string, json_path ) WHERE: json_string is the JSON string from which the &hellip; <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_query-function-in-sql-server-2016\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">JSON_QUERY Function in Sql Server 2016<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,830],"tags":[884,865,871,832,895,907,908,881,882,883,804,887,885,906,888,321,986,834,886],"class_list":["post-4124","post","type-post","status-publish","format-standard","hentry","category-sql-server","category-sql-server-2016","tag-difference-between-json_query-and-json_value","tag-json","tag-json-in-sql","tag-json-in-sql-server","tag-json-in-sql-server-2016","tag-json-query","tag-json-query-in-sql","tag-json_query","tag-json_query-in-sql-server","tag-json_query-in-sql-server-2016","tag-level-16","tag-line-4","tag-msg-13608","tag-msg-13608-level-16-state-2-line-4-property-cannot-be-found-in-specified-path","tag-property-cannot-be-found-in-specified-path","tag-sql","tag-sql-server","tag-sql-server-2016","tag-state-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3xNAz-14w","_links":{"self":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts\/4124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/comments?post=4124"}],"version-history":[{"count":12,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts\/4124\/revisions"}],"predecessor-version":[{"id":4384,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts\/4124\/revisions\/4384"}],"wp:attachment":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/media?parent=4124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/categories?post=4124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/tags?post=4124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}