<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JSON data &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/json-data/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 24 Apr 2017 18:25:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server 2016: Use WITHOUT_ARRAY_WRAPPER to remove [square brackets] from JSON</title>
		<link>https://www.dbrnd.com/2017/04/sql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 20 Apr 2017 16:16:28 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[JSON data]]></category>
		<category><![CDATA[JSON String]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[WITHOUT_ARRAY_WRAPPER]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5055</guid>

					<description><![CDATA[SQL Server 2016 came with varieties of JSON options. We had a requirement like select table data into JSON format and also combine this result with other table&#8217;s JSON. When you are trying to get JSON formatted data using FOR JSON PATH, it adds [square brackets] in a JSON string which may create a problem, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json%2F&#038;title=SQL%20Server%202016%3A%20Use%20WITHOUT_ARRAY_WRAPPER%20to%20remove%20%5Bsquare%20brackets%5D%20from%20JSON" data-a2a-url="https://www.dbrnd.com/2017/04/sql-server-2016-use-without_array_wrapper-to-remove-square-brackets-from-json/" data-a2a-title="SQL Server 2016: Use WITHOUT_ARRAY_WRAPPER to remove [square brackets] from JSON"></a></p><p>SQL Server 2016 came with varieties of JSON options. We had a requirement like select table data into JSON format and also combine this result with other table&#8217;s JSON.</p>
<blockquote><p>When you are trying to get JSON formatted data using FOR JSON PATH, it adds [square brackets] in a JSON string which may create a problem, while you are combining the many JSONs.</p></blockquote>
<p>You can use WITHOUT_ARRAY_WRAPPER option to remove this additional [square brackets].</p>
<p><strong>Below is a full demonstration of this:</strong></p>
<p><strong>Create a table with sample records:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_Students
(
	Rno INT PRIMARY KEY
	,STudName VARCHAR(20)
	,ClassName CHAR(1)
)
GO
 
INSERT INTO tbl_Students 
VALUES 
(1,'Anvesh','A'),(2,'Neevan','B'),(3,'Toby','C')
,(5,'Roy','A'),(4,'Jenny','B'),(6,'Kaviy','C')
,(7,'Martin','A'),(8,'Laxmi','B'),(9,'Nion','C')
GO</pre><p>
&nbsp;</p>
<p>Prepare JSON using FOR JSON PATH:<br />
You can see additional [ ] in the result string.<br />
<pre class="crayon-plain-tag">SELECT TOP 2 *
FROM tbl_Students
ORDER BY Rno
FOR JSON PATH
GO

--Result:
--[{"Rno":1,"STudName":"Anvesh","ClassName":"A"},{"Rno":2,"STudName":"Neevan","ClassName":"B"}]</pre>
<strong>Prepare JSON using FOR JSON PATH, WITHOUT_ARRAY_WRAPPER:</strong><br />
Now, you can find result string without [ ].<br />
<pre class="crayon-plain-tag">SELECT TOP 2 *
FROM tbl_Students
ORDER BY Rno
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER
GO

--Result:
--{"Rno":1,"STudName":"Anvesh","ClassName":"A"},{"Rno":2,"STudName":"Neevan","ClassName":"B"}</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
