<?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>SSIS JSON File Destination Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/components/ssis-json-file-destination/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/components/ssis-json-file-destination/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 19 Mar 2025 13:31:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>SSIS JSON File Destination Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/components/ssis-json-file-destination/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Calling SharePoint 365 REST API in SSIS</title>
		<link>https://zappysys.com/blog/sharepoint-365-rest-api-ssis-read-list-write-create/</link>
		
		<dc:creator><![CDATA[ZappySys Team]]></dc:creator>
		<pubDate>Mon, 28 May 2018 21:56:14 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON File Destination]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[SSIS XML File Destination]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[explorer]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=3674</guid>

					<description><![CDATA[<p>Introduction to REST API with SharePoint in SSIS Using REST API with SharePoint in SSIS is a common requirement to Administer SharePoint. SharePoint 365 is a nice Microsoft application in the Cloud used to share documents and collaborate with the company. You can have schedules, projects, documents and more shared using a Web platform. In addition, [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/sharepoint-365-rest-api-ssis-read-list-write-create/">Calling SharePoint 365 REST API in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction to REST API with SharePoint in SSIS</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/sharepoint-connector/ssis">API Connector for SharePoint Online</a> which makes it much simpler to <strong>Read/Write SharePoint Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/sharepoint-icon.jpg"><img decoding="async" class="alignleft wp-image-3731 " src="https://zappysys.com/blog/wp-content/uploads/2018/05/sharepoint-icon-150x150.jpg" alt="icon SharePoint" width="86" height="86" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/sharepoint-icon-150x150.jpg 150w, https://zappysys.com/blog/wp-content/uploads/2018/05/sharepoint-icon.jpg 225w" sizes="(max-width: 86px) 100vw, 86px" /></a>Using REST API with SharePoint in SSIS is a common requirement to Administer SharePoint. SharePoint 365 is a nice Microsoft application in the Cloud used to share documents and collaborate with the company. You can have schedules, projects, documents and more shared using a Web platform.</p>
<p>In addition, it is a very useful tool that your company may need. It is also possible to automate, administer task using Rest API.<br />
This article, we will learn how to create REST API queries to SharePoint 365 using the Microsoft Graph API using SSIS. To learn about other <a href="https://zappysys.com/blog/calling-office-365-api-using-ssis-graph-api-mail-calendar-contacts-onedrive-excel/" target="_blank" rel="noopener">Office 365 REST API in SSIS check this article</a> (Outlook, Onedrive, mail, Excel API).</p>
<p>Also, we will show our ZappySys SSIS PowerPack that includes very powerful tools to export SharePoint data from REST API to any other source.<br />
<div class="su-table su-table-alternate">
<table width="300">
<tbody>
<tr style="line-height: 0px">
<td width="50px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" rel="noopener"><br />
<img decoding="async" class="alignnone size-full wp-image-3074" src="https://zappysys.com/images/SSIS-PowerPack/ssis-rest-api-web-service-task.png" alt="REST API Web Service Task SSIS" width="50" height="50" /></a></td>
<td style="vertical-align: middle"><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" rel="noopener">SSIS REST API Web Service Task<br />
</a></td>
</tr>
<tr style="line-height: 0px">
<td style="height: 58px" width="50px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" rel="noopener"><br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3074" src="https://zappysys.com/images/SSIS-PowerPack/SSIS-Json-Source-Adapter.png" alt="JSON Source (File, REST API, OData Connector) SSIS" width="50" height="50" /></a></td>
<td style="vertical-align: middle;height: 58px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" rel="noopener">SSIS JSON Source (File, REST API, OData Connector)</a></td>
</tr>
<tr style="line-height: 0px">
<td style="height: 58px" width="50px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/" rel="noopener"><br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3074" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-file-destination/ssis-json-file-destination.png" alt="JSON File Destination (Create JSON File) SSIS" width="50" height="50" /></a></td>
<td style="vertical-align: middle;height: 58px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/" rel="noopener">SSIS JSON File Destination (Create JSON File)<br />
</a></td>
</tr>
</tbody>
</table>
</div>
<h2>Requirements to REST API with SharePoint</h2>
<ol>
<li>First, you will need SSDT installed.</li>
<li>Second, SSIS PowerPack installed.</li>
<li>An Office 365 Account with SharePoint 365</li>
</ol>
<h2>Getting started</h2>
<p>Microsoft included the Microsoft Graph to easily create API queries to different Microsoft components like OneDrive, Excel, Insights, Microsoft Team, Planner and more.</p>
<p>The Microsoft Graph is a gateway to access to 365 Data in an integrated platform. Let’s start with the Microsoft Graph Explorer and do some REST API queries to understand how to use REST API in SharePoint.</p>
<h3>Microsoft Graph Explorer to SharePoint introduction</h3>
<p>The best way to learn REST API with SharePoint 365 is to use the Graph Explorer. You can run API queries using the Graph Explorer and get your data. Here we will show how.</p>
<ol>
<li>First, we will go to the <a href="https://developer.microsoft.com/en-us/graph/graph-explorer">Graph Explorer</a> and sign-in with your Office 365 Account.</li>
<li>Secondly, in Run Query, you can specify your query, which will show SharePoint information.
<div id="attachment_10091" style="width: 730px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-explorer-1.jpg" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10091" class="wp-image-10091 size-large" title="Graph Explorer" src="https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-explorer-1-1024x428.jpg" alt="graph api explorer" width="720" height="301" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-explorer-1-1024x428.jpg 1024w, https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-explorer-1-300x125.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-explorer-1-768x321.jpg 768w, https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-explorer-1.jpg 1348w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-10091" class="wp-caption-text">Graph Explorer</p></div></li>
<li>Let start with this link:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/sites/root/lists</pre>
</li>
<li>This shows properties about site resources. The response of the query is in JSON format:
<div id="attachment_3695" style="width: 732px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-microsoft-json-results.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3695" class="size-full wp-image-3695" src="https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-microsoft-json-results.jpg" alt="graph api microsoft json results" width="722" height="299" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-microsoft-json-results.jpg 722w, https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-microsoft-json-results-300x124.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/graph-api-microsoft-json-results-720x299.jpg 720w" sizes="(max-width: 722px) 100vw, 722px" /></a><p id="caption-attachment-3695" class="wp-caption-text">Graph API Microsoft JSON results</p></div></li>
<li>Also, it is possible to enable examples for SharePoint Sites, SharePoint Lists, and other Microsoft technologies:
<div id="attachment_3696" style="width: 435px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-enable-api-applicatins.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3696" class="size-full wp-image-3696" src="https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-enable-api-applicatins.jpg" alt="microsoft graph api enable api applicatins" width="425" height="450" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-enable-api-applicatins.jpg 425w, https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-enable-api-applicatins-283x300.jpg 283w" sizes="(max-width: 425px) 100vw, 425px" /></a><p id="caption-attachment-3696" class="wp-caption-text">Graph API Applications</p></div></li>
</ol>
<h3>Create an OAuth connection to REST API with SharePoint in SSIS</h3>
<ol>
<li style="list-style-type: none;">
<ol>
<li>First, to get the Data from the Microsoft Graph, we will sign in to create an application in the <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/app-registration-portal-training-guide">Azure Portal app registration.</a></li>
<li>Secondly, create a Microsoft Application. It will provide you an Application ID and a Password. For detailed steps about how to create a Microsoft Application, check <a href="https://zappysys.com/blog/calling-office-365-api-using-ssis-graph-api-mail-calendar-contacts-onedrive-excel/">our article related</a>.
<div id="attachment_3701" style="width: 1310px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-application-id-password.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3701" class="size-full wp-image-3701" src="https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-application-id-password.jpg" alt="microsoft graph api application id password" width="1300" height="467" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-application-id-password.jpg 1300w, https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-application-id-password-300x108.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-application-id-password-768x276.jpg 768w, https://zappysys.com/blog/wp-content/uploads/2018/05/microsoft-graph-api-application-id-password-1024x368.jpg 1024w" sizes="(max-width: 1300px) 100vw, 1300px" /></a><p id="caption-attachment-3701" class="wp-caption-text">Microsoft Graph API application id password</p></div></li>
<li>Once that the application is created, go to SSDT or Visual Studio and create a new connection.
<div id="attachment_3704" style="width: 419px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oauth-connection.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3704" class="size-full wp-image-3704" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oauth-connection.jpg" alt=" oauth connection ssis" width="409" height="445" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oauth-connection.jpg 409w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-oauth-connection-276x300.jpg 276w" sizes="(max-width: 409px) 100vw, 409px" /></a><p id="caption-attachment-3704" class="wp-caption-text">SSIS OAuth connection</p></div></li>
<li>Select the ZS-OAuth connection. Once selected, enter the Client ID (the Microsoft Graph Application ID), the client secret (application password).</li>
<li>Add the Authorization URL is the following:<br />
<pre class="crayon-plain-tag">https://login.microsoftonline.com/common/oauth2/v2.0/authorize</pre>
</li>
<li>Also, include the Access token URL is the following:<br />
<pre class="crayon-plain-tag">https://login.microsoftonline.com/common/oauth2/v2.0/token</pre>
</li>
<li>The following permissions were applied in the example: User.Read<br />
<pre class="crayon-plain-tag">offline_access
Sites.ReadWrite.all
Sites.Manage.All
Sites.FullControl.All</pre>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> It is advised to include <strong>offline_access</strong> scope in order to get a Refresh Token and to be free of any token restrictions.</div></div></li>
<li>Once that the properties are entered, press the Generate token button:
<div id="attachment_3706" style="width: 781px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/oauth-graph-api.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3706" class="wp-image-3706 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/oauth-graph-api.jpg" alt="oauth graph API with REST API with SharePoint in SSIS" width="771" height="697" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/oauth-graph-api.jpg 771w, https://zappysys.com/blog/wp-content/uploads/2018/05/oauth-graph-api-300x271.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/oauth-graph-api-768x694.jpg 768w" sizes="(max-width: 771px) 100vw, 771px" /></a><p id="caption-attachment-3706" class="wp-caption-text">SSIS OAuth with REST API with SharePoint in SSIS</p></div></li>
</ol>
</li>
</ol>
<h3>How to call SharePoint API in SSIS</h3>
<ol>
<li>Once that your OAuth Connection is created, we can use it in a REST API task. This task is included with the ZappySys SSIS PowerPack:
<div id="attachment_3707" style="width: 304px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3707" class="size-full wp-image-3707" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task.jpg" alt=" rest api ssis task" width="294" height="199" /></a><p id="caption-attachment-3707" class="wp-caption-text">SSIS REST API task</p></div></li>
<li>Secondly, in the REST API Task, select the option URL from connection and select the OAuth connection created before. We will first use the following URL to see the list of site properties:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/sites/root/lists</pre>
</li>
<li>Also, press Test request/Response button to get the results of the query:
<div id="attachment_3708" style="width: 810px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-rest-api-call.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3708" class="size-full wp-image-3708" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-rest-api-call.jpg" alt="ssis sharepoint rest api call" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-rest-api-call.jpg 800w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-rest-api-call-300x245.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-rest-api-call-768x628.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-3708" class="wp-caption-text">SSIS SharePoint rest API call</p></div></li>
<li>The response will be in JSON format:
<div id="attachment_3710" style="width: 759px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/rest-api-ssis-sharepoint-365-response.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3710" class="size-full wp-image-3710" src="https://zappysys.com/blog/wp-content/uploads/2018/05/rest-api-ssis-sharepoint-365-response.jpg" alt="rest api ssis sharepoint 365 response" width="749" height="534" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/rest-api-ssis-sharepoint-365-response.jpg 749w, https://zappysys.com/blog/wp-content/uploads/2018/05/rest-api-ssis-sharepoint-365-response-300x214.jpg 300w" sizes="(max-width: 749px) 100vw, 749px" /></a><p id="caption-attachment-3710" class="wp-caption-text">REST API SSIS Sharepoint 365 response</p></div></li>
<li>Also, it is possible to store the results in a file or a variable:
<div id="attachment_3711" style="width: 808px" class="wp-caption alignleft"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-save-api-sharepoint-response-to-file.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3711" class="wp-image-3711 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-save-api-sharepoint-response-to-file.jpg" alt="SSIS save API SharePoint response to file REST API with SharePoint" width="798" height="658" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-save-api-sharepoint-response-to-file.jpg 798w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-save-api-sharepoint-response-to-file-300x247.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-save-api-sharepoint-response-to-file-768x633.jpg 768w" sizes="(max-width: 798px) 100vw, 798px" /></a><p id="caption-attachment-3711" class="wp-caption-text">SSIS save API SharePoint response to a file REST API with SharePoint</p></div></li>
<li>In Addition, you can run the following query to enumerate all the sites:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites?select=siteCollection,webUrl&amp;filter=siteCollection/root%20ne%20null</pre>
</li>
<li>Also, to show the information on a specific site, the following query will be used:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/sites/site-id</pre>
</li>
<li>For example, if you site id is zappysys.sharepoint.com the URL would be the following:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/sites/zappysys.sharepoint.com</pre>
</li>
<li>To enumerate sites, the following example can be useful:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites?select=siteCollection,webUrl&amp;filter=siteCollection/root%20ne%20null</pre>
</li>
<li>Also, to enumerate lists, you can use the following URL:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites/zappysys.sharepoint.com/lists</pre>
</li>
</ol>
<h3>How to read SharePoint lists in SSIS using REST API</h3>
<p>We will learn how to show SharePoint lists using rest API.</p>
<p>In addition, you can get the list ids using this query:</p><pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites/zappysys.sharepoint.com/list</pre><p>
<div id="attachment_3743" style="width: 810px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/SSIS-SharePoint-list.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3743" class="wp-image-3743 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/SSIS-SharePoint-list.jpg" alt="SSIS SharePoint list API" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/SSIS-SharePoint-list.jpg 800w, https://zappysys.com/blog/wp-content/uploads/2018/05/SSIS-SharePoint-list-300x245.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/SSIS-SharePoint-list-768x628.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-3743" class="wp-caption-text">SharePoint list API</p></div>
<h3>How to read data from a Sharepoint List</h3>
<ol>
<li>To get the list of ithems form a list use the following query:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites/zappysys.sharepoint.com/lists/mylist/items/</pre>
</li>
<li>Finally, to get metadata from a list, you can use the following query. To learn more how to import Sharepoint List into SQL Server <a href="https://zappysys.com/blog/loading-data-from-rest-api-to-sql-server-in-ssis/" target="_blank" rel="noopener">use JSON / REST API Source</a>.</li>
</ol>
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites/zappysys.sharepoint.com/lists/fcf5fa2b-ceeb-4c9b-80e5-7bedd455fc9b</pre>
<div id="attachment_3742" style="width: 810px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-metadata-list.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3742" class="size-full wp-image-3742" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-metadata-list.jpg" alt=" sharepoint ssismetadata list" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-metadata-list.jpg 800w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-metadata-list-300x245.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-metadata-list-768x628.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-3742" class="wp-caption-text">SSIS Sharepoint metadata list</p></div>
<h3>How to create a SharePoint list item in SSIS using REST API (POST Method)</h3>
<p>It is also possible to POST data using REST API. In the next example, we will create a new list in SharePoint 365 using REST API.</p>
<ol>
<li>First, in SSDT, use the REST API Task used previously and specify the following URL:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites/zappysys.sharepoint.com/lists/mynewlist/items/</pre>
Where zappys.sharepoint.com is the site id and mynewlist is a new list created. Also, in the HTTP Request Method, use the POST method.</li>
<li>In addition, go to the Body Request, we will create a widget. We will use the following JSON data and make sure to select JSON (application/json) in the body:<br />
<pre class="crayon-plain-tag">{
"fields": {
"Title": "Widget"
}
}</pre>
<div id="attachment_3718" style="width: 810px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-post-sharepoint-365-list-item.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3718" class="wp-image-3718 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-post-sharepoint-365-list-item.jpg" alt="Post SharePoint REST API" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-post-sharepoint-365-list-item.jpg 800w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-post-sharepoint-365-list-item-300x245.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-post-sharepoint-365-list-item-768x628.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-3718" class="wp-caption-text">SharePoint Post REST API</p></div></li>
<li>Finally, if everything is successful, you will be able to see the new item created:
<div id="attachment_3719" style="width: 712px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-list-created-post.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3719" class="wp-image-3719 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-list-created-post.jpg" alt="sharepoint ssis list created post " width="702" height="381" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-list-created-post.jpg 702w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-sharepoint-list-created-post-300x163.jpg 300w" sizes="(max-width: 702px) 100vw, 702px" /></a><p id="caption-attachment-3719" class="wp-caption-text">SSIS SharePoint list created with a POST</p></div></li>
</ol>
<h3>How to export SharePoint API response results to a file</h3>
<p>We have a nice task named JSON Source used to get data from REST API or a JSON file and export to any source the results like SQL Server, Excel, a flat file, etc.<br />
In this example, we will export data from the JSON Source to a JSON file using the JSON Destination Task.</p>
<ol>
<li>First of all, we will use the Data Flow. Drag and drop the data flow to the design pane and double click to go to the Data Flow tab:
<div id="attachment_3721" style="width: 328px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-data-flow-1.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3721" class="wp-image-3721 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-data-flow-1.jpg" alt=" Data Flow SSIS" width="318" height="95" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-data-flow-1.jpg 318w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-data-flow-1-300x90.jpg 300w" sizes="(max-width: 318px) 100vw, 318px" /></a><p id="caption-attachment-3721" class="wp-caption-text">SSIS Data Flow</p></div></li>
<li>Secondly, in the Data Flow tab, drag and drop the JSON Source, the JSON Destination and join them:
<div id="attachment_3722" style="width: 540px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-to-json-destinatin.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3722" class="wp-image-3722 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-to-json-destinatin.jpg" alt=" json source to json destination ssis" width="530" height="384" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-to-json-destinatin.jpg 530w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-to-json-destinatin-300x217.jpg 300w" sizes="(max-width: 530px) 100vw, 530px" /></a><p id="caption-attachment-3722" class="wp-caption-text">SSIS JSON source to JSON destination</p></div></li>
<li>In addition, in the JSON Source, we will check the option Use Credentials and select the OAuth connection created and used before.</li>
<li>Enter Path or Web URL, we will use the following URL:<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/beta/sites/zappysys.sharepoint.com/lists</pre>
</li>
<li>Also, We will use the following filter:<br />
<pre class="crayon-plain-tag">$.value[*].list</pre>
<div id="attachment_3724" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/json-source-sharepoint.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3724" class="wp-image-3724 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/json-source-sharepoint.jpg" alt=" json ssis source REST API with SharePoint in SSIS" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/json-source-sharepoint.jpg 826w, https://zappysys.com/blog/wp-content/uploads/2018/05/json-source-sharepoint-300x266.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/json-source-sharepoint-768x682.jpg 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-3724" class="wp-caption-text">SSIS JSON Source REST API with SharePoint in SSIS</p></div></li>
<li>In addition, go to JSON Destination task, select mappings and right click on add elements:
<div id="attachment_3725" style="width: 884px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-destination.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3725" class="wp-image-3725 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-destination.jpg" alt="json destination ssis" width="874" height="700" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-destination.jpg 874w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-destination-300x240.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-destination-768x615.jpg 768w" sizes="(max-width: 874px) 100vw, 874px" /></a><p id="caption-attachment-3725" class="wp-caption-text">SSIS JSON Destination</p></div></li>
<li>Also, select the attributes:
<div id="attachment_3727" style="width: 405px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-add-attributes.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3727" class="wp-image-3727 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-add-attributes.jpg" alt=" add attributes ssis" width="395" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-add-attributes.jpg 395w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-add-attributes-271x300.jpg 271w" sizes="(max-width: 395px) 100vw, 395px" /></a><p id="caption-attachment-3727" class="wp-caption-text">SSIS add attributes</p></div></li>
<li>Finally, run the package to export the data.</li>
</ol>
<h2>Conclusion about REST API with SharePoint in SSIS</h2>
<p>To conclude, we can say that SharePoint 365 is a very popular application to share documents and information. With REST API it is possible to get data properties and administer SharePoint. We used the REST API, JSON Source to get and send information. If you want to try yourself, you can download our tools <a href="https://zappysys.com/products/ssis-powerpack/download/">here.</a></p>
<h2>References</h2>
<ul>
<li><a href="https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user">Get access on behalf of a user</a></li>
<li><a href="https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/sharepoint">Working with SharePoint sites in Microsoft Graph</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/">About SSIS PowerPack</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/sharepoint-365-rest-api-ssis-read-list-write-create/">Calling SharePoint 365 REST API in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Ways to Export JSON from SQL Server using SSIS</title>
		<link>https://zappysys.com/blog/export-json-from-sql-server-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 07 Dec 2015 19:38:44 +0000</pubDate>
				<category><![CDATA[SSIS JSON Export Task]]></category>
		<category><![CDATA[SSIS JSON File Destination]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS Logging Task]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS Export JSON Task]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=209</guid>

					<description><![CDATA[<p>Introduction SQL Server 2012 and all previous versions lacking native JSON support, same theory is true for their ETL Platform SSIS. If you are one of them who wants to export JSON from SQL Server or any other RDBMS like MySQL, Oracle then you can easily output complex JSON using any of the following components. Five ways of [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/export-json-from-sql-server-using-ssis/">5 Ways to Export JSON from SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>SQL Server 2012 and all previous versions lacking native JSON support, same theory is true for their ETL Platform SSIS. If you are one of them who wants to export JSON from SQL Server or any other RDBMS like MySQL, Oracle then you can easily output complex JSON using any of the following components.</p>
<h2>Five ways of creating JSON inside SSIS</h2>
<p>ZappySys toolset provides multiple ways creating JSON inside SSIS. You can choose method suitable for your scenario. Each method has pros and cons so choose it as per your need.</p>
<h3>JSON File Destination</h3>
<p><img decoding="async" class="alignleft" style="font-family: inherit; font-size: inherit;" title="SSIS JSON Destination (Create JSON File)" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-file-destination/ssis-json-file-destination.png" alt="SSIS JSON Destination (Create JSON File)" width="100" /><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/" target="_blank" rel="noopener">SSIS JSON Destination</a> can be used to generate simple or complex JSON files out of relational data source such as SQL Server, Oracle, MySQL. In few clicks you can create desired JSON Shape from single or multiple tables (Parent/Child Nested Documents).</p>
<p><strong>PROS:</strong> Multiple data flow components can be attached. Which means unlike <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">Export JSON Task</a> you are not limited to OLEDB or ODBC Sources only.</p>
<p><strong>CONS:</strong> When you remove upstream component it may break Dataset mappings. Also server side Lookup Option is not available. File Splitting Options not available.</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/components/ssis-json-file-destination/" target="_blank" rel="noopener">some articles</a> for use case of this component.</p>
<div id="attachment_5358" style="width: 943px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5358" class="size-full wp-image-5358" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png" alt="JSON File Destination - Generate JSON in SSIS from multiple inputs" width="933" height="784" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png 933w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-768x645.png 768w" sizes="(max-width: 933px) 100vw, 933px" /></a><p id="caption-attachment-5358" class="wp-caption-text">JSON File Destination &#8211; Generate JSON in SSIS from multiple inputs</p></div>
<h3>JSON Generator Transform</h3>
<h3><span style="font-size: 16px;"><img decoding="async" class="alignleft" title="JSON Generator Transform" src="https://zappysys.com/images/SSIS-PowerPack/ssis-json-generator-transform.png" alt="JSON Generator Transform" width="100" /></span></h3>
<p><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> can be used to generate single or multiple JSON documents from any type of data sources (e.g. SQL Server, MySQL, Flat File, Excel) inside data flow task. It takes multiple inputs and outputs JSON String Output Column which can be used to feed JSON to other downstream system.</p>
<p><strong>PROS:</strong> Multiple data flow components can be attached. Which means unlike <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">Export JSON Task</a> you are not limited to OLEDB or ODBC Sources only.</p>
<p><strong>CONS:</strong> When you remove upstream component it may break Dataset mappings. Also server side Lookup Option is not available. File Splitting Options not available. Output is JSON String Column.</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/components/ssis-json-generator-transform/" target="_blank" rel="noopener">some articles</a> for use case of this transform.</p>
<div id="attachment_4918" style="width: 792px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4918" class="size-full wp-image-4918" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert.png" alt="Preview JSON - Generate for BigQuery Table Insert" width="782" height="640" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert.png 782w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert-300x246.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-preview-json-for-bigquery-dataset-insert-768x629.png 768w" sizes="(max-width: 782px) 100vw, 782px" /></a><p id="caption-attachment-4918" class="wp-caption-text">Preview JSON &#8211; Generate for BigQuery Table Insert</p></div>
<h3>Export JSON Task</h3>
<p><em><img decoding="async" class="alignleft" src="https://zappysys.com/images/SSIS-PowerPack/ssis-export-json-file-task.png" alt="SSIS Export JSON File Task" /></em><a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">SSIS Export JSON File Task</a> can be used to generate simple or complex JSON files out of relational data source such as SQL Server, Oracle, MySQL. It also support exporting directly to cloud (e.g. Azure Blob Storage, Amazon AWS S3, Secure FTP). In few clicks you can create desired JSON Shape from single or multiple tables (Parent/Child Nested Documents)</p>
<p><strong>PROS:</strong> Simple to use with flexible options to export to file, variable, AWS S3, Azure Blob, FTP / SFTP location. Allows to split records. File Splitting Options available (Split By Size  / Row Count).</p>
<p><strong>CONS:</strong> You can only use limited data sources as Dataset input (e.g. OLEDB / ODBC or SQL Server).</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-json-export-task/" target="_blank" rel="noopener">some articles</a> for use case of this task.</p>
<h3>Template Transform</h3>
<p><img decoding="async" class="alignleft" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/template-transform/ssis-template-transform.png" alt="SSIS SSIS Template Transform" />Template Transform can be used to create dynamic strings inside data flow. You can use upstream columns as placeholders or use SSIS variables anywhere in the template to create desired text (e.g. XML / JSON document).</p>
<p><strong>PROS:</strong> Very Simple to use.</p>
<p><strong>CONS:</strong> Cannot use multiple inputs. It may not be used to create Complex JSON and options like do not output NULL attributes is not possible.</p>
<p>&nbsp;</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/components/ssis-template-transform/" target="_blank" rel="noopener">some articles</a> for use case of this transform.</p>
<div id="attachment_2614" style="width: 983px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2614" class="size-full wp-image-2614" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png" alt="Create JSON for API Request (POST) using SSIS Template Transform" width="973" height="611" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png 973w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call-768x482.png 768w" sizes="(max-width: 973px) 100vw, 973px" /></a><p id="caption-attachment-2614" class="wp-caption-text">Create JSON for API Request (POST) using SSIS Template Transform</p></div>
<h3>Logging Task (Control Flow Approach)</h3>
<p><img decoding="async" class="alignleft" src="https://zappysys.com/images/SSIS-PowerPack/ssis-logging-task.png" /> Just like Template Transform you can use <a href="https://zappysys.com/products/ssis-powerpack/ssis-logging-task-free/" target="_blank" rel="noopener">ZS Logging Task</a> to create JSON string from Template and Variable Placeholders.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Here is how to use Logging Task to save JSON into a variable.</p>
<ol>
<li>Select Variable which you like to Set on Logging Task</li>
<li>Enter your Template JSON String which you like to produce (see example below). Notice the use of yyyy-MM-dd <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">format specifier</a> and also JSONENCODE function.<br />
<pre class="crayon-plain-tag">{
 ActionId: {{User::vActionId}},
 CreatedOn: "{{User::vOrderDate,yyyy-MM-ddTHH:mm:ss}}",
 Notes: "{{User::vNotes,JSONENCODE}}"
}</pre>
</li>
<li>Select Message Type = <strong>None</strong></li>
<li><strong>Uncheck Append</strong>, and <strong>Prefix</strong> options like below
<div id="attachment_222" style="width: 732px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-222" class="wp-image-222 size-full" src="https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png" alt="Creating JSON / XML Document using SSIS Logging Task" width="722" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png 722w, https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder-300x219.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></a><p id="caption-attachment-222" class="wp-caption-text">Creating JSON / XML Document using SSIS Logging Task</p></div></li>
</ol>
<p>&nbsp;</p>
<p>Here are <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-logging-task/" target="_blank" rel="noopener">some articles</a> for use case of this task.</p>
<p>&nbsp;</p>
<h2>Create JSON using SSIS Export JSON Task</h2>
<p>Now let&#8217;s look at Export JSON Task form example to create JSON. Steps listed in below sections are very similar to JSON File Destination or JSON Generator Transform.</p>
<p>ZappySys offers innovative Layout Editor for JSON / XML creation from multiple sources. You can use Layout Editor to produce desired JSON Layout (Layout is stored in XML format behind the scene) and then in later step you will see how to make it dynamic so values are changed at runtime.</p>
<p>You can read layout as direct value, read from variable or read from file from disk.</p>
<h3>Select source connection for data</h3>
<p>First lets create new OLEDB or ADO.net connection from where we will read data. In our case we reading from Northwind Database.</p>
<div id="attachment_216" style="width: 565px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-216" class="size-full wp-image-216" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection.png" alt="SSIS JSON Export Task - Select Source Database Connection" width="555" height="218" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection.png 555w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-task-source-connection-300x118.png 300w" sizes="(max-width: 555px) 100vw, 555px" /></a><p id="caption-attachment-216" class="wp-caption-text">SSIS JSON Export Task &#8211; Select Source Database Connection</p></div>
<h3>Create Datasets</h3>
<p>Now add datasets which will be used to produce JSON File. One dataset will be always Root Dataset (Example: If your Root information is about customer then select customer table or query as your Main dataset. All other sections will be child sections)</p>
<div id="attachment_215" style="width: 419px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-215" class="size-full wp-image-215" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset.png" alt="Add SQL Dataset - Export JSON from SQL Query Option" width="409" height="431" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset.png 409w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-source-dataset-285x300.png 285w" sizes="(max-width: 409px) 100vw, 409px" /></a><p id="caption-attachment-215" class="wp-caption-text">Add SQL Dataset &#8211; Export JSON from SQL Query Option</p></div>
<h3>Add Output Columns for Main JSON Document</h3>
<p>Now its time to add columns for our output. If * is added by default then remove. * means output all columns. When you add columns first make sure you select correct parent node under which you want to add columns. In our case &#8220;Mappings&#8221; is parent node.</p>
<div id="attachment_214" style="width: 391px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-214" class="size-full wp-image-214" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns.png" alt="Add Output Columns for JSON Document - Column Selection Screen" width="381" height="446" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns.png 381w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-add-columns-256x300.png 256w" sizes="(max-width: 381px) 100vw, 381px" /></a><p id="caption-attachment-214" class="wp-caption-text">Add Output Columns for JSON Document &#8211; Column Selection Screen</p></div>
<h3>Add JSON Array / JOIN Conditions for related document</h3>
<p>Now let&#8217;s look at how to add JSON Array. For example Customer may have one or more Orders so we need to add node called Orders which may Produce JSON fragment like below</p>
<pre class="crayon-plain-tag">Orders : [ {...} , {...} ] </pre>
<p>Once customer related columns added, its time to add Orders section.</p>
<ol>
<li>This is Array of documents so first highlight &#8220;Mappings&#8221; node</li>
<li>Click &#8220;Add Document Array&#8221; option from toolbar.</li>
<li>On Add/Edit Elements UI specify name for JSON Attribute and specify correct relationship to parent dataset. In our case Orders related to Customers using CustomerID key.</li>
</ol>
<div id="attachment_212" style="width: 548px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-212" class="size-full wp-image-212" src="//zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation.png" alt="Add Child Section - nested JSON document , Define Parent-Child Relationship" width="538" height="432" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation.png 538w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-output-from-sql-server-parent-child-relation-300x241.png 300w" sizes="(max-width: 538px) 100vw, 538px" /></a><p id="caption-attachment-212" class="wp-caption-text">Add Child Section &#8211; nested JSON document , Define Parent-Child Relationship</p></div>
<h3>Handling JSON Array with dummy root dataset (Multiple Arrays)</h3>
<p>So in previous section we saw how to add array and define JOIN condition with parent dataset. Now what if you really have no parent dataset to join with ? For example we need to produce following sample JSON where Order array is related to Customer by common Column CustomerID as JOIN column. But Customer is not bound with any parent column. So how do you define JOIN condition? In such case you have to use below technique called dummy root dataset. (See next section on how to handle only one dataset using <strong>Single Dataset Array Mode</strong>)</p>
<p><strong>Sample JSON (Dummy root pattern)</strong></p><pre class="crayon-plain-tag">{
    "Customers": [
      {
        "CustomerID": "ALFKI",
        "CompanyName": "Alfreds Futterkiste",
        "Orders": [
          {
            "OrderID": 1000,
            "OrderDate": "2015-12-01"
          },
          {
            "OrderID": 1001,
            "OrderDate": "2015-12-01"
          }
        ]
      },

      {
        "CustomerID": "ANATR",
        "CompanyName": "Ana Trujillo Emparedados y helados",
        "Orders": [
          {
            "OrderID": 1002,
            "OrderDate": "2015-12-01"
          },
          {
            "OrderID": 1003,
            "OrderDate": "2015-12-01"
          }
        ]
      }

    ]
  }
}</pre><p>
Since root level always needs dataset, we must provide dummy dataset (only one row) even though there is no need for Parent Dataset JOIN in Customer Array. Typically you can write query like below to product dummy row in SQL Server or other database using OLEDB Source or Use <a href="https://zappysys.com/products/ssis-powerpack/dummy-data-source-free/" target="_blank" rel="noopener">Dummy Data Source</a> with Max Rows=1 setting to produce one fake record.</p><pre class="crayon-plain-tag">SELECT 1 as Col1</pre><p>
<strong>Using Dummy DataSource as Input</strong></p>
<p>For generating JSON which needs dummy root. Perform the following steps</p>
<ol>
<li>Drag Dummy Data Source from SSIS Toolbox. Change <strong>How many rows</strong> to 1. Click OK</li>
<li>Now drag two more OLEDB sources and Configure (e.g. Customers and Orders)</li>
<li>Now drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-destination-connector/">ZS JSON FIle Destination</a> component or <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/">ZS JSON Generator</a></li>
<li>Now connect Dummy datasource then Customers and then Orders</li>
<li>Double click JSON component to configure layout. You may notice that Dummy Input is set as Root by default.</li>
<li>You can now select Mappings node and click on Add Array Documents icon. Configure like below. Notice we have not selected any JOIN criteria because its joined with Dummy Root.
<div id="attachment_5357" style="width: 785px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5357" class="size-full wp-image-5357" src="https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export.png" alt="Add array to join with dummy dataset" width="775" height="617" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export.png 775w, https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export-300x239.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/dummy-root-pattern-ssis-json-export-768x611.png 768w" sizes="(max-width: 775px) 100vw, 775px" /></a><p id="caption-attachment-5357" class="wp-caption-text">Add array to join with dummy dataset</p></div></li>
<li>Now select newly added node and Click Add column icon to add CustomerID, CompanyName column under Customers array</li>
<li>Now select Customers array node and click Array Documents icon to Add Orders array.</li>
<li>Once Orders Array ia added you can Select Orders node and Insert new element to add OrderID and OrderDate columns</li>
<li>Finally it will look like below
<div id="attachment_5358" style="width: 943px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5358" class="size-full wp-image-5358" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png" alt="JSON File Destination - Generate JSON in SSIS from multiple inputs" width="933" height="784" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source.png 933w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-generate-json-using-dummy-root-multiple-input-source-768x645.png 768w" sizes="(max-width: 933px) 100vw, 933px" /></a><p id="caption-attachment-5358" class="wp-caption-text">JSON File Destination &#8211; Generate JSON in SSIS from multiple inputs</p></div></li>
</ol>
<p>&nbsp;</p>
<h3>Single dataset used as array</h3>
<p>Now lets look at one more pattern just like described in the previous section but now we have just one nested level (Only customers and not using Orders). If you have such case then choose Single dataset pattern option in the output mode. On Export Task you may see as check box rather than dropdown. To produced desired JSON (see blow) perform these steps.</p>
<ol>
<li>Select Output mode as <strong>Single Dataset Array</strong></li>
<li>In your Layout builder click on <strong>Add Document Array</strong> Icon and name it &#8220;Customers&#8221;.</li>
<li>After that highlight newly added node &gt; Right-Click &gt; <strong>Add Elements</strong> under that node</li>
<li>That&#8217;s it you will now see preview like below.</li>
</ol>
<pre class="crayon-plain-tag">{
    "Customers": [
      {
        "CustomerID": "ALFKI",
        "CompanyName": "Alfreds Futterkiste"
      },

      {
        "CustomerID": "ANATR",
        "CompanyName": "Ana Trujillo Emparedados y helados"
      }
    ]
  }
}</pre>
&nbsp;</p>
<h3>How to export JSON in 2D Array format</h3>
<p>If you have to export JSON as 2D array format then you can change following option.</p>
<p><img decoding="async" class="figureimage" title="SSIS Export to JSON File Task - Export as 2D Array" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/export-json-file-task/ssis-export-json-2d-array-format.png" alt="SSIS Export JSON File Task - Export as 2D Array" /></p>
<p>Here are examples of output for each option.<br />
Select say you have source data with 2 columns <i>id</i> and <i>name</i>.</p>
<p><b>Default</b></p><pre class="crayon-plain-tag">[{id:1,name:&quot;AA&quot;}, {id:2,name:&quot;BB&quot;}]</pre><p>
<b>Multicontent</b></p><pre class="crayon-plain-tag">{id:1,name:&quot;AA&quot;}{id:2,name:&quot;BB&quot;}</pre><p>
<b>ArrayDocs</b></p><pre class="crayon-plain-tag">[{id:1,name:&quot;AA&quot;}, {id:2,name:&quot;BB&quot;}]</pre><p>
<b>Array2D</b></p><pre class="crayon-plain-tag">[[1,&quot;AA&quot;],[2,&quot;BB&quot;]]</pre><p>
<b>Array2DWithHeader</b></p><pre class="crayon-plain-tag">[[&quot;id&quot;,&quot;name&quot;],[1,&quot;AA&quot;],[2,&quot;BB&quot;]]</pre><p>
<b>ArrayLines</b></p><pre class="crayon-plain-tag">[1,&quot;AA&quot;][2,&quot;BB&quot;]</pre><p>
<b>ArrayLinesWithHeader</b></p><pre class="crayon-plain-tag">[&quot;id&quot;,&quot;name&quot;][1,&quot;AA&quot;][2,&quot;BB&quot;]</pre><p>
&nbsp;</p>
<h3>Preview JSON output using live preview</h3>
<p>You can enable / disable Live preview of JSON layout as below.</p>
<div id="attachment_210" style="width: 573px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-210" class="size-full wp-image-210" src="//zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png" alt="JSON Output preview in SSIS Export JSON File Task" width="563" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png 563w, https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis-300x253.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></a><p id="caption-attachment-210" class="wp-caption-text">JSON Output preview in SSIS Export JSON File Task</p></div>
<h2>Make things dynamic (Using SSIS Variable for SQL or Layout)</h2>
<p>There will be a time when you have use dynamic values in your JSON generation. You may have to Alias something from variable or you have to supply Variable in your SQL used for Dataset. Not to worry. ZappySys Supports multiple ways to make it dynamic. You can use SSIS Variables following 3 ways to make Layout XML dynamic.</p>
<ol>
<li>Use SSIS variable inside Dataset SQL (Only for <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">ZS Export JSON Task</a>)</li>
<li>Anywhere inside Layout XML (Click <strong>Edit Code</strong> option)</li>
<li>Load Layout From Variable (Indirect Method)</li>
</ol>
<h3>Using Variable inside Dataset SQL</h3>
<p>Here is how you can use Variable inside dataset SQL for <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">ZS Export JSON Task</a></p>
<div id="attachment_5359" style="width: 736px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5359" class="size-full wp-image-5359" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable.png" alt="SSIS Export JSON Task - Using Variable for Dynamic SQL" width="726" height="538" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable.png 726w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-export-json-dynamic-dataset-sql-use-variable-300x222.png 300w" sizes="(max-width: 726px) 100vw, 726px" /></a><p id="caption-attachment-5359" class="wp-caption-text">SSIS Export JSON Task &#8211; Using Variable for Dynamic SQL</p></div>
<h3>Using Variable inside Layout XML</h3>
<p>Here is how you can insert SSIS Variable anywhere in Layout XML. In below Example we are choosing Alias for one column from some SSIS Variable.</p>
<div id="attachment_5360" style="width: 865px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5360" class="size-full wp-image-5360" src="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout.png" alt="SSIS JSON File Destination - Using SSIS Variable for Dynamic Layout" width="855" height="591" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout.png 855w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout-300x207.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/12/ssis-json-file-destination-use-ssis-variable-dynamic-layout-768x531.png 768w" sizes="(max-width: 855px) 100vw, 855px" /></a><p id="caption-attachment-5360" class="wp-caption-text">SSIS JSON File Destination &#8211; Using SSIS Variable for Dynamic Layout</p></div>
<h3>Load Layout From Variable</h3>
<p>If you have some need to load Layout XML from File or SSIS Variable. You can use Load Layout from Variable Option.</p>
<p>For example in below screenshot we are creating layout first and ave to some variable. Or you can load from external file using <a href="https://zappysys.com/products/ssis-powerpack/ssis-file-system-task-advanced/">ZS Advanced File System Task</a>.  Connect Logging task to Export JSON Task and you ready to produce JSON.</p>
<div id="attachment_222" style="width: 732px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-222" class="size-full wp-image-222" src="//zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png" alt="Set SSIS Variable value (multi-line content using placeholder)" width="722" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder.png 722w, https://zappysys.com/blog/wp-content/uploads/2015/12/set-ssis-variable-value-multi-line-placeholder-300x219.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></a><p id="caption-attachment-222" class="wp-caption-text">Set SSIS Variable value (multi-line content using placeholder)</p></div>
<p>Here is how to load Layout From any SSIS Variable. You can also load Layout from XML file or Variable which contains layout File Path.</p>
<div id="attachment_210" style="width: 573px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-210" class="wp-image-210 size-full" src="https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png" alt="JSON Layout from SSIS Variable" width="563" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis.png 563w, https://zappysys.com/blog/wp-content/uploads/2015/12/sql-server-json-output-preview-ssis-300x253.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></a><p id="caption-attachment-210" class="wp-caption-text">JSON Layout from SSIS Variable</p></div>
<h2>Other JSON Output Options</h2>
<p>Execute package and verify generated JSON it should look like below (Date format may be different in your case if you have set different on JSON options tab). For clarity we have formatted JSON below but in your output it may be compact version so reduce file size.</p>
<h3>Indent JSON Output</h3>
<p>You can check Indent option to make JSON look pretty like below.</p><pre class="crayon-plain-tag">{
  "CustomerID": "ALFKI",
  "CompanyName": "Alfreds Futterkiste",
  "ContactName": null,
  "Orders": [
    {
      "OrderID": 10643,
      "OrderDate": "1997-08-25T00:00:00"
    },
    {
      "OrderID": 10692,
      "OrderDate": "1997-10-03T00:00:00"
    },
    {
      "OrderID": 10702,
      "OrderDate": "1997-10-13T00:00:00"
    },
    {
      "OrderID": 10835,
      "OrderDate": "1998-01-15T00:00:00"
    },
    {
      "OrderID": 10952,
      "OrderDate": "1998-03-16T00:00:00"
    },
    {
      "OrderID": 11011,
      "OrderDate": "1998-04-09T00:00:00"
    }
  ]
}</pre><p>
<h3>Hide NULL Attribute Option</h3>
<p>There will be a time when you want to Hide NULL attribute rather than showing <strong>MyAttr: null</strong> this is also possible by checking Hide NULL Attribute Option on Options Tab.</p>
<h2>Export JSON to Amazon S3, Azure Blob, Secure FTP (SFTP / FTPS)</h2>
<p>Export JSON Task support some really good options to save file to other than local file system. If you want to export JSON directly to Amazon / Azure Cloud or FTP Server without saving to local disk then you can use Azure / FTP / Amazon Connection Manager on Target Tab of Export JSON Task. This option is only available for <strong>PRO Edition</strong> Users.</p>
<div style="width: 666px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/export-json-file-task/ssis-export-sql-tables-to-json-file-azure-blob-amazon-s3-secure-ftp-split-gzip-compress.png" alt="Export JSON / CSV / XML Files to Azure Blob, Amazon S3, Secure FTP Storage" width="656" height="440" /><p class="wp-caption-text">Export JSON / CSV / XML Files to Azure Blob, Amazon S3, Secure FTP Storage</p></div>
<h2>Conclusion</h2>
<p>If you want to output JSON from SQL Server or any other relational DB then its not simple task in SSIS specially when you have nested JSON documents (e.g. Customer-&gt;Orders). In this post you have seen how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/">SSIS JSON Export Task</a> to generate nested JSON from multiple datasets.</p>
<p>The post <a href="https://zappysys.com/blog/export-json-from-sql-server-using-ssis/">5 Ways to Export JSON from SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
