<?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>jsonpath Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/jsonpath/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/jsonpath/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Tue, 23 Sep 2025 23:00:11 +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>jsonpath Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/jsonpath/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to call SOAP / REST API using Dynamic Token in SSIS / ODBC</title>
		<link>https://zappysys.com/blog/call-soap-rest-api-using-dynamic-token-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 07 Jul 2018 09:03:41 +0000</pubDate>
				<category><![CDATA[HTTP Connection]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[jsonpath]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[xpath]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=4378</guid>

					<description><![CDATA[<p>Introduction In this blog, we will learn how to call SOAP / REST API using Dynamic Token in SSIS (i.e. Two steps authentication approach &#8211; Fist Call Login API to get token and then call API). In our previous blog post, we saw how to call Web API using some industry standards approaches, such as [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/call-soap-rest-api-using-dynamic-token-ssis/">How to call SOAP / REST API using Dynamic Token in SSIS / ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/REST-API-icon.jpg"><img decoding="async" class="size-full wp-image-4254 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/06/REST-API-icon.jpg" alt="Logo REST API" width="217" height="232" /></a>In this blog, we will learn how to call SOAP / REST API using Dynamic Token in SSIS (i.e. Two steps authentication approach &#8211; Fist Call Login API to get token and then call API).</p>
<p>In our previous blog post, we saw how to call Web API using some industry standards approaches, such as <a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/" target="_blank" rel="noopener">OAuth 2.0 Authorization</a> or <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener">Basic Authorization</a>. However, not all APIs follow the industry standard to authenticate API requests. After talking with many customers we noticed that very common non-standard technique to authenticate API is Dynamic Token Approach. In this approach first, you have to call Login request to get a temporary token (i.e. sessionid ). Once you get that temp token you can supply it along with your API requests. These temp token/session id usually expires in short time (i.e. expire in one hour or so).</p>
<p>Sounds complicated? Well not really if you use ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> or <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC Drivers for API</a>. In this post, we will go through the steps, to authenticate using Dynamic Token approach. We will show you features of  <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm">ZappySys SSIS HTTP Connection Manager</a>. For example purpose, we will call XML SOAP API using <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">SSIS XML Source Connector</a> but same concepts can be applied to read from JSON API using  <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source Connector</a> or CSV API using <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">CSV Source Connector</a>.</p>
<p>So let&#8217;s get started.</p>
<h2></h2>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Getting Started</h2>
<p>In order to start, we will show several examples. ZappySys includes an <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">SSIS XML Source Connector</a> and  <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source Connector</a> that will help you to call SOAP / REST API, read various data from SOAP / REST API with SSIS.</p>
<p>To get token from login / authentication URL you have to gather a few pieces from your API documentation.</p>
<ul>
<li>How to call Login API for your API &#8211; (This is not the same URL as Vendor Site Login Page, but its usually API Login endpoint e.g. https://somecompany/api/v2/login)</li>
<li>API Response Format (e.g. JSON, XML ,CSV or Random Text )</li>
</ul>
<p>In our below example steps, we will use XML API which requires POST method first to pass Userid / password to authenticate. If Authentication is successful it may return a response in XML format which contains token.</p>
<p>In the next step, we will call other API (e.g. get-data) and pass token as Authorization Header. All these steps will be done automatically using  <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm">ZappySys SSIS HTTP Connection Manager</a>.</p>
<h2>Create HTTP Connection for Dynamic Token</h2>
<p>To get API response data using SOAP / REST API call, you need to get an API Token from your login request URL. I am using ZappySys sample SOAP API to show you for the Demo purpose. Follow the steps mentioned below to get API Token:</p>
<h3>Create in SSIS</h3>
<ol>
<li>Right Click on Connection Managers Window, and one Context menu appears for creating a new connection manager.
<div id="attachment_10775" style="width: 742px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/Select-connection.png"><img decoding="async" aria-describedby="caption-attachment-10775" class="size-full wp-image-10775" src="https://zappysys.com/blog/wp-content/uploads/2018/07/Select-connection.png" alt="Select new connection" width="732" height="446" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/Select-connection.png 732w, https://zappysys.com/blog/wp-content/uploads/2018/07/Select-connection-300x183.png 300w" sizes="(max-width: 732px) 100vw, 732px" /></a><p id="caption-attachment-10775" class="wp-caption-text">Connection Manager Window: Create New Connection</p></div>
<div class="mceTemp"></div>
</li>
<li>Select ZS HTTP Connection Manager from the list of Connection Managers and, double-click on it or click on Add button to add a new Connection Manager. By Default, The created connection manager is of Package-Level. You can set Project Level Connection manager too If you want.
<div id="attachment_10776" style="width: 486px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/Select-HTTP-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10776" class="size-full wp-image-10776" src="https://zappysys.com/blog/wp-content/uploads/2018/07/Select-HTTP-connection.png" alt="Connection list from SSIS" width="476" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/Select-HTTP-connection.png 476w, https://zappysys.com/blog/wp-content/uploads/2018/07/Select-HTTP-connection-293x300.png 293w" sizes="(max-width: 476px) 100vw, 476px" /></a><p id="caption-attachment-10776" class="wp-caption-text">List of SSIS Connection Managers – Select HTTP Connection Manager</p></div></li>
</ol>
<h3>Create in ODBC</h3>
<p>To use HTTP Connection in ODBC Drivers you can change connection Type to HTTP like below and it will show similar UI discussed in this article.</p>
<div id="attachment_10777" style="width: 814px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/Create-HTTP-connection-in-ODBC.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10777" class="size-full wp-image-10777" src="https://zappysys.com/blog/wp-content/uploads/2018/07/Create-HTTP-connection-in-ODBC.png" alt="New HTTP connection in ODBC" width="804" height="522" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/Create-HTTP-connection-in-ODBC.png 804w, https://zappysys.com/blog/wp-content/uploads/2018/07/Create-HTTP-connection-in-ODBC-300x195.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/Create-HTTP-connection-in-ODBC-768x499.png 768w" sizes="(max-width: 804px) 100vw, 804px" /></a><p id="caption-attachment-10777" class="wp-caption-text">Create an HTTP connection inside an ODBC driver</p></div>
<h2>Configure HTTP Connection Credential Type</h2>
<p>Once you add new SSIS ZS HTTP Connection Manager, Go to General Tab and Configure HTTP Connection Manager for Two Step Authorization Flow. Enter API URL, Login Credentials, and configure some basic settings for the same. We used Login URL as just example but you can enter any valid API URL endpoint here. Actual Login URL goes on Dynamic Token Tab (see next step)</p>
<div id="attachment_10778" style="width: 628px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-general-tab.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10778" class="size-full wp-image-10778" src="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-general-tab.png" alt="HTTP connection with dynamic token in ODBC" width="618" height="515" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-general-tab.png 618w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-general-tab-300x250.png 300w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-10778" class="wp-caption-text">SSIS ZS HTTP Connection Manager: General Tab Configurations Settings</p></div>
<h2>Configure Request Settings</h2>
<p>Once you enter Username / password details on General Tab now we need to setup some information like Login Request URL, Body, Headers. Lets look at few options.</p>
<h3><strong>Passing User ID /Password in Body</strong></h3>
<ol>
<li>Go to Dynamic Token tab, Enter the following pieces.
<ol>
<li>Token/API Login URL<br />
For our example enter API Login URL as:<br />
<pre class="crayon-plain-tag">https://zappysys.com/downloads/files/test/soap-login.aspx</pre></li>
<li>Request Method as <strong>POST</strong></li>
<li>Request Body as below. Notice we used <pre class="crayon-plain-tag">[$userid$]</pre>  and <pre class="crayon-plain-tag">[$password$]</pre>  placeholders. These are replaced automatically at runtime so you do not have to hard code in Body and keep it secure. (See General Tab to enter UserID/Password)<br />
<strong>Pass User ID / Password in Body</strong><br />
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:urn=""urn:partner.soap.sforce.com""&gt;
   &lt;soapenv:Body&gt;
      &lt;urn:login&gt;
         &lt;urn:username&gt;[$userid$]&lt;/urn:username&gt;
         &lt;urn:password&gt;[$password$]&lt;/urn:password&gt;
      &lt;/urn:login&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
</li>
<li>Select Request Body Content Type. For JSON data it may be application/json. For Key/Value Pair  <strong>key1=value1&amp;key2=value2</strong> leave it Default.<strong>Passing User ID /Password in Request BODY</strong>
<div id="attachment_10779" style="width: 858px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-tab.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10779" class="size-full wp-image-10779" src="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-tab.png" alt="HTTP connection dynamic tab" width="848" height="797" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-tab.png 848w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-tab-300x282.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-tab-768x722.png 768w" sizes="(max-width: 848px) 100vw, 848px" /></a><p id="caption-attachment-10779" class="wp-caption-text">SSIS ZS HTTP Connection Manager: Dynamic Token Tab Configurations Settings of Request Tab</p></div></li>
</ol>
</li>
</ol>
<h3><strong>Passing User ID / Password in URL (GET Request)</strong></h3>
<p>Our Example API pass credentials in the <strong>POST</strong> body but some API may pass via URL as <strong>GET</strong> request.</p>
<p>In such case, you can enter like this<br />
<pre class="crayon-plain-tag">https://mysite.com/api/v2/login?userid=[$userid$]&amp;password=[$password$]</pre>
Notice in above URL we used <pre class="crayon-plain-tag">[$userid$]</pre>  and <pre class="crayon-plain-tag">[$password$]</pre>   placeholders. These are replaced automatically at runtime (See General Tab to enter UserID/Password)</p>
<h3><strong>Passing User ID /Password in Header as Basic Authentication</strong></h3>
<p>Another scenario is API requires <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener">HTTP Basic authentication</a>, (Pass User ID / Password in Header as Base64 encoded value) then you can pass credentials like this:</p>
<p><code style="margin-bottom: 10pt;">Authorization: Basic &lt;&lt;[$userid$]:[$password$],FUN_BASE64ENC&gt;&gt;<br />
</code></p>
<p>Here we have used <code style="margin-bottom: 10pt;">FUN_BASE64ENC</code> function but there are <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">many other functions</a> can be used anywhere in Body or Headers</p>
<div id="attachment_10780" style="width: 652px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-header-ODBC.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10780" class="size-full wp-image-10780" src="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-header-ODBC.png" alt="HTTP connection dynamic token in header request credentials" width="642" height="512" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-header-ODBC.png 642w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-configuration-header-ODBC-300x239.png 300w" sizes="(max-width: 642px) 100vw, 642px" /></a><p id="caption-attachment-10780" class="wp-caption-text">Using Basic Authentication in Dynamic Token approach</p></div>
<h2>Configure Response Settings</h2>
<p>Now lets configure how to extract token (single value) from response. Which can be XML, JSON or sometimes Raw Text. We support 4 modes (default = None means full response text is treated as token). If you want to extract just single value and not full text then use below settings.</p>
<h3>XML Expression Type (Use XPath)</h3>
<ol>
<li>Now, Go to Response Settings tab under a Dynamic Token tab, Enter Response Settings like Token Extract Mode, Expression Type, Content Filter Expression as below XPath Expression. The expression basically extracts content from sessionid XML node using below <a href="https://zappysys.com/blog/ssis-extract-single-xml-node-using-xpath-soap-response/" target="_blank" rel="noopener">XPath Expression</a>.<pre class="crayon-plain-tag">//*[local-name()='sessionid']</pre>
<div id="attachment_10781" style="width: 650px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10781" class="size-full wp-image-10781" src="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab.png" alt="Get XML response for dynamic token" width="640" height="510" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab.png 640w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-300x239.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-10781" class="wp-caption-text">ODBC ZS HTTP Connection Manager: Dynamic Token Tab Configurations Settings of Response Tab</p></div></li>
<li>That&#8217;s it click on OK button to save your Connection Manager Configurations.</li>
</ol>
<h3>JSON Expression Type (Use JSONPath)</h3>
<p>If you API returns JSON response (like <a href="https://zappysys.com/blog/read-walmart-api-data-ssis-odbc/">Walmart API Example</a>) then you can do something like below. Choose Expression Type=JSON and in Response Content Filter You can enter expression like $.some_property_name  (e.g. $.access_token). Check more about How to write <a href="https://zappysys.com/blog/jsonpath-examples-expression-cheetsheet/">JSON Path expression here</a>.</p>
<div id="attachment_10782" style="width: 793px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-SSIS.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10782" class="size-full wp-image-10782" src="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-SSIS.png" alt="Walmart API – Extract Token – Response Settings" width="783" height="646" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-SSIS.png 783w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-SSIS-300x248.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-SSIS-768x634.png 768w" sizes="(max-width: 783px) 100vw, 783px" /></a><p id="caption-attachment-10782" class="wp-caption-text">SSIS ZS HTTP Connection Manager &#8211; Get a JSON response for the token</p></div>
<h3>Regular Expression Type (Use Regex)</h3>
<p>Another advanced mode to extract token from response is Regex Mode. You can write any valid regular expression <a href="https://zappysys.com/blog/using-regular-expressions-in-ssis/" target="_blank" rel="noopener">like this one</a> to extract just one value.</p>
<p>For example if your response returns raw string with token in double quotes but you want just token and no double quotes around it then try something like below.</p>
<div id="attachment_10783" style="width: 793px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-regex-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10783" class="size-full wp-image-10783" src="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-regex-example.png" alt="Dynamic token from a regex expression" width="783" height="646" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-regex-example.png 783w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-regex-example-300x248.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/HTTP-connection-dynamic-token-response-settings-tab-regex-example-768x634.png 768w" sizes="(max-width: 783px) 100vw, 783px" /></a><p id="caption-attachment-10783" class="wp-caption-text">Extract Token from response – Remove double quotes around value using Regular Expression</p></div>
<h2><strong>Call API </strong><strong>in SSIS with </strong><strong>Dynamic API Token</strong></h2>
<p>Now once you have setup HTTP connection manager to authenticate and get API token, we are ready for next step. Now we can use that token in SOAP / REST API Service call. So, let&#8217;s move to the SSIS Part.</p>
<ol>
<li>Once SSIS Package is open, Goto Data Flow Section, For that Drag and Drop DataFlow Task from the SSIS Toolbox.
<div id="attachment_10784" style="width: 472px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-data-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10784" class="wp-image-10784 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-data-flow.png" alt="Use data flow " width="462" height="157" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-data-flow.png 462w, https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-data-flow-300x102.png 300w" sizes="(max-width: 462px) 100vw, 462px" /></a><p id="caption-attachment-10784" class="wp-caption-text">Drag and drop Data flow task</p></div></li>
<li>Now, Drag and Drop SSIS ZS XML Source Component from the SSIS Toolbox (if your API is JSON based then drag ZS JSON Source).
<div id="attachment_10785" style="width: 854px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-XML-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10785" class="wp-image-10785 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-XML-source.png" alt="Drag and Drop ZS SSIS XML Source Component" width="844" height="401" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-XML-source.png 844w, https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-XML-source-300x143.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/SSIS-drag-and-drop-XML-source-768x365.png 768w" sizes="(max-width: 844px) 100vw, 844px" /></a><p id="caption-attachment-10785" class="wp-caption-text">Drag and Drop ZS SSIS XML Source Component</p></div></li>
<li>Let&#8217;s double-click on XML Source Component to configure it&#8217;s Properties. Enter Request URL.<br />
<pre class="crayon-plain-tag">https://zappysys.com/downloads/files/test/soap-getdata.aspx</pre>
<div id="attachment_10786" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-URL.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10786" class="wp-image-10786 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-URL.png" alt="Enter URL to XML source" width="828" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-URL.png 828w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-URL-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-URL-768x682.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10786" class="wp-caption-text">SSIS XML Source: Enter your SOAP Request URL</p></div></li>
<li>Check Use Credentials (Username/Password OR Token), Select HTTP Connection Manager from the drop-down list, we have created just before.
<div id="attachment_10787" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-credential.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10787" class="wp-image-10787 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-credential.png" alt="USe a credentials inside XML source" width="828" height="374" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-credential.png 828w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-credential-300x136.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-enter-credential-768x347.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10787" class="wp-caption-text">ZS SSIS XML Source Component: Check Use Credentials and Select Connection Manager</p></div></li>
<li>Select the Request Method and Enter SOAP Request Body something like this. Notice that we used <strong>[$token$]</strong> as a placeholder. This is automatically replaced at runtime by ZS-HTTP Connection Manager.<strong>Passing Token in Body</strong><br />
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com"&gt;
   &lt;soapenv:Body&gt;
      &lt;urn:sessionid&gt;[$token$]&lt;/urn:sessionid&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
<strong>Passing Token in Header<br />
</strong><br />
If your API expects token via HTTP Header (e.g. <strong>Authorization:</strong> <strong>xxxx-my-token-xxxxxxxx</strong> ) then make sure you configure Auth Scheme and Header name on HTTP Connection. By default it sends Token in Authorization header if you dont do anything.</p>
<div id="attachment_10788" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-Header.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10788" class="size-full wp-image-10788" src="https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-Header.png" alt="Dynamic Token in the header" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-Header.png 826w, https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-Header-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-Header-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-10788" class="wp-caption-text">ZS SSIS XML Source Component: Enter SOAP Request Body</p></div></li>
<li>Select Content-Type as per your Request, here we are selecting <pre class="crayon-plain-tag">text/XML;charset=UTF-8</pre>  and adding 1 HTTP Header: <pre class="crayon-plain-tag">SOAPAction: "https://zappysys.com/soap-getdata"</pre>
<div id="attachment_10789" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-body.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10789" class="size-full wp-image-10789" src="https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-body.png" alt="Select Content-Type Add HTTP Request Header" width="828" height="742" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-body.png 828w, https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-body-300x269.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/Passing-Token-in-body-768x688.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10789" class="wp-caption-text">ZS SSIS XML Source Component: Select Content-Type Add HTTP Request Header</p></div></li>
<li>select Filter Path: set as per your requirements. here for this example, we are setting:<br />
<pre class="crayon-plain-tag">$.soapenv:Envelope.soapenv:Body.urn:Row[*]</pre>
<div id="attachment_10790" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10790" class="size-full wp-image-10790" src="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result.png" alt="XML source filter with dynamic token" width="828" height="742" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result.png 828w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-300x269.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-768x688.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10790" class="wp-caption-text">ZS SSIS XML Source Component: Select Filter</p></div>
<p>&nbsp;</li>
<li>Check Include Parent Columns checkbox, for including parent Columns, and then click on Preview button to see the Preview data.
<div id="attachment_10791" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-preview.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10791" class="size-full wp-image-10791" src="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-preview.png" alt="Preview data XML source dynamic token" width="828" height="742" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-preview.png 828w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-preview-300x269.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/XML-source-dynamic-token-result-preview-768x688.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10791" class="wp-caption-text">SSIS XML Source Component: See the Preview data</p></div></li>
<li>That&#8217;s it. Click on OK button to Save your Configuration.</li>
<li>Finally drag any destination (i.e. OLEDB Destination) from your SSIS toolbox. If you want to load this data into SQL, then Drag OLE DB Destination Component, and configure it.</li>
</ol>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>In this blog, we learned how to call any SOAP/REST API with Dynamic Token, retrieve Service response data with SSIS using <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source <span style="color: #0000ee;"><u>Component</u></span></a> OR <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Component</a>   in a very simple way. Furthermore, you can achieve many more functionalities with this tool. Check our blogs/articles on <strong>XML Source Component </strong>to find out what <em>this tool</em> is capable of more.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information about the call any SOAP / REST API with Dynamic Token feature with our tools:</p>
<ul>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source</a>, you can also find <a href="https://youtu.be/2Li6Vy-nQvw">Tutorial Video</a> here.</li>
<li><strong>Help File:</strong> Documentation of <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-xml-source.htm">XML Source</a>.</li>
</ul>
<p>The post <a href="https://zappysys.com/blog/call-soap-rest-api-using-dynamic-token-ssis/">How to call SOAP / REST API using Dynamic Token in SSIS / ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Reading JSON Arrays from file / REST API</title>
		<link>https://zappysys.com/blog/extract-read-multiple-arrays-from-json-data-file-rest-api-response/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 11 Jan 2016 16:50:48 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json source]]></category>
		<category><![CDATA[jsonpath]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json parser transform]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis xml parser transform]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=298</guid>

					<description><![CDATA[<p>Introduction REST API is becoming more and more common and with that you will see explosion in use of JSON data format. One of the questions we get a lot is &#8220;How to extract or read array from JSON data file&#8221; or &#8220;How to read multiple arrays from JSON data&#8220;. Example : Store JSON document [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/extract-read-multiple-arrays-from-json-data-file-rest-api-response/">Reading JSON Arrays from file / REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/SSIS-Json-Source-Adapter.png"><img loading="lazy" decoding="async" class="size-full wp-image-3074 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2016/01/SSIS-Json-Source-Adapter.png" alt="" width="100" height="100" /></a><a href="https://en.wikipedia.org/wiki/Representational_state_transfer" target="_blank" rel="noopener">REST API</a> is becoming more and more common and with that you will see explosion in use of JSON data format. One of the questions we get a lot is &#8220;<em>How to extract or read array from JSON data file</em>&#8221; or &#8220;<em>How to read multiple arrays from JSON data</em>&#8220;. Example : Store JSON document has Customers[&#8230;] and Employees[&#8230;] arrays and lets say you want to extract both and save to target SQL server database. In this post you will learn how to make this possible and how to make it fast with some performance tips. We will use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source (File, REST API Connector)</a></p>
<p>If you want to learn how to parse Multi-Dimensional JSON arrays then check <a href="//zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">this article</a>.</p>
<h2>Video Tutorial &#8211; Read from multiple arrays from JSON document</h2>
<a href="https://zappysys.com/blog/extract-read-multiple-arrays-from-json-data-file-rest-api-response/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FOt7z8BIFbis%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Read array from JSON document</h2>
<p>To extract subdocument or array content from JSON document you need to use <strong>JSON Path</strong> expression. Lets check following example JSON document.</p><pre class="crayon-plain-tag">{
  "store": {
    "employees": [
      {
        "name": "bob",
        "hiredate": "2015-01-01"
      },
      {
        "name": "sam",
        "hiredate": "2015-01-02"
      },
      {
        "name": "ken",
        "hiredate": "2015-01-03"
      }
    ],
    "books": [
      {
        "category": "reference",
        "author": "bob",
        "title": "hellooo1",
        "price": 1.95,
        "sections": [
          "s1",
          "s2",
          "s3"
        ]
      },
      {
        "category": "fiction",
        "author": "sam",
        "title": "hellooo2",
        "price": 1.96,
        "sections": [
          "s4",
          "s1",
          "s3"
        ]
      },
      {
        "category": "science",
        "author": "steve",
        "title": "hellooo3",
        "tag": "1bcd",
        "price": 11,
        "sections": [
          "s9",
          "s2",
          "s3"
        ]
      }
    ],
    "location": {
      "street": "123 Main St.",
      "city": "Newyork",
      "state": "GA"
    }
  }
}</pre><p>
Below is example filter expression to extract common elements</p><pre class="crayon-plain-tag">$.store.books[*]       //get all books for store              
$.store.employees[*]       //get all employees for store                 
$.store.books[*].sections[*]       //get all sections from all books   
$.store.books[*].author //get all authors of all books for store           
$.store.books[*]    //get all books for store  
$.store.books[2]    //get 3rd book record
$.store.books[:2]   //get first 2 books from the top
$.store.books[-2:]  //get last 2 books
$.store.books[?(@.price &lt; 10)] //get books where price is less than 10
$.store.books[?(@.tag)] //filter all books with tag</pre><p>
<h2>Read single array from JSON data (JSON Path expression)</h2>
<p>SSIS PowerPack comes with powerful REST API Connectors for <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML </a> . In below example screenshot you will see how to extract single array section from your JSON File. But if you have multiple array sections (e.g. books and employees from above example) then you have to use Multiple JSON Source Connectors for same JSON File.</p>
<p><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-data-read-from-file-url.png" alt="Read Json File data from Web Url Example in SSIS" /></p>
<h2>Read multiple arrays from JSON data</h2>
<p>If you have scenario to extract multiple arrays from same JSON (e.g. extract Employees and Books from store ) then you have two options. You can pick any approach which suites your need (Method-1 is recommended).</p>
<ol>
<li>Method-1: Use single JSON Source with [Output As Document] option and feed that to <a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></li>
<li>Method-2: Use multiple JSON Sources with different filter expressions</li>
<li>Method-3: Enable <strong>Array Flattening</strong> Option (Useful if you have smaller arrays &#8211; i.e. less than 10 items) &#8211; <strong>Version v2.7.6+</strong></li>
</ol>
<p>Now lets discuss each approach in detail.</p>
<h3>Method-1: Use single JSON Source along with JSON Parser Transform</h3>
<p><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/release-notes.htm#v2_2" target="_blank" rel="noopener">SSIS PowerPack v2.2</a> released new <a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">XML Parser Transform</a> which can be used to parse any input JSON/XML data coming from upstream in pipeline. It parse input string  column into multiple columns how JSON/XML Source does but the only difference is JSON Parser takes String as input from existing upstream column.</p>
<p>Here are the steps to parse multiple JSON arrays using JSON Parser Transform. For example purpose we will use sample store json listed above.</p>
<ol>
<li>Drag new data flow in SSIS Control Flow designer. Double click on Data flow<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Drag ZS JSON Source from SSIS Toolbox. Configure Source, Filter and other property.<br />
<img decoding="async" class="figureimage" title="SSIS JSON Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="SSIS JSON Source - Drag and Drop" /></li>
<li>Check [<strong>Output As Document</strong>] option (Found under Access Mode dropdown). Click preview. From grid <strong>copy one sample document from __DOCUMENT__ column</strong>. (Right click on Cell and Copy).This is raw JSON which we will use later to feed as sample in JSON Parser Transform (If you cant copy JSON then obtain some other way)
<div id="attachment_9175" style="width: 627px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-output-row-document-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9175" class="size-full wp-image-9175" src="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-output-row-document-option.png" alt="Enable Output As Raw Document Option - SSIS JSON Source" width="617" height="753" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-output-row-document-option.png 617w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-output-row-document-option-246x300.png 246w" sizes="(max-width: 617px) 100vw, 617px" /></a><p id="caption-attachment-9175" class="wp-caption-text">Enable Output As Raw Document Option &#8211; SSIS JSON Source</p></div></li>
<li>Click OK to save JSON Source.</li>
<li>Drag Multicast Transform (Native SSIS Transform) from Toolbox
<div id="attachment_9174" style="width: 546px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-toolbox-drag-multicast-transform.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9174" class="size-full wp-image-9174" src="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-toolbox-drag-multicast-transform.png" alt="Drag &amp; Drop SSIS MultiCast Transform from Toolbox on designer surface" width="536" height="204" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-toolbox-drag-multicast-transform.png 536w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-toolbox-drag-multicast-transform-300x114.png 300w" sizes="(max-width: 536px) 100vw, 536px" /></a><p id="caption-attachment-9174" class="wp-caption-text">Drag &amp; Drop SSIS MultiCast Transform from Toolbox on designer surface</p></div></li>
<li>Connect JSON Source to Multicast Transform</li>
<li>Drag first <a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a> from Toolbox. Rename it to [Parse Employees]. Connect blue arrow coming from Multicast to JSON Parser Transform</li>
<li>Drag second <a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a> from Toolbox. Rename it to [Parse Books]. Connect blue arrow coming from Multicast to JSON Parser Transform</li>
<li>Double click [Parse Employees]. Select <strong>__DOCUMENT__</strong> as upstream column. Enter sample JSON you obtained in step#3. Click on select Filter and highlight Employees node (i.e. $.store.employees[*] ). Click preview to see data.
<div id="attachment_2399" style="width: 714px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2399" class="size-full wp-image-2399" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png" alt="Use JSON Parser Transform to parse Elasticsearch API HTTP JSON response into columns to redirect the rows later" width="704" height="622" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png 704w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration-300x265.png 300w" sizes="(max-width: 704px) 100vw, 704px" /></a><p id="caption-attachment-2399" class="wp-caption-text">Use <em>JSON Parser Transform</em> to parse Raw JSON document</p></div></li>
<li><strong>Very Important:</strong>Click Columns tab and verify metadata (e.g. datatype, length). If you think you need extra columns or bigger column length then change in the grid and check [Lock] option found in the last grid column. If column length is smaller than output data then you will get error message when you run package. You can review error message carefully to determine which column needs to be adjusted  (Repeat this until you clear all errors).</li>
<li>Click OK to save [Parse Employees].</li>
<li>Double click [Parse Books]. Select __DOCUMENT__ as upstream column. Enter sample JSON you obtained in step#3. Click on select Filter and highlight Books node (i.e. $.store.books[*] ). Click ok. Click preview to see data.</li>
<li>Perform same steps as #11 for  [Parse Books] to set correct metadata.</li>
<li>Click OK to save [Parse Books].</li>
<li>Drag ZS Trash destination from Toolbox. Connect Trash destination to [Parse Employees]</li>
<li>Drag ZS Trash destination from Toolbox. Connect Trash destination to [Parse Books]</li>
<li>Run the package and you will see both 2 outputs from different JSON Parser with different row count.</li>
</ol>
<p>Here is how it will look like</p>
<div style="width: 789px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/ssis-json-extract-multiple-array-output-using-parser.png" alt="Extract multiple array output from JSON file / REST API response in (SSIS JSON Source, JSON Parser Transform)" width="779" height="555" /><p class="wp-caption-text">Extract multiple array output from JSON file / REST API response in (SSIS JSON Source, JSON Parser Transform)</p></div>
<p>&nbsp;</p>
<h3>Method-2: Use multiple JSON Sources with different filter expressions</h3>
<p>You can consider using multiple JSON Source (each source with unique filter expression). Since one JSON source can only extract one array or Document.. You have to use below technique to read multiple arrays from same JSON document.</p>
<div id="attachment_322" style="width: 601px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/read-multiple-array-from-json-data-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-322" class="size-full wp-image-322" src="//zappysys.com/blog/wp-content/uploads/2016/01/read-multiple-array-from-json-data-file.png" alt="Read array from JSON data - Reading multiple array or single array" width="591" height="293" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/read-multiple-array-from-json-data-file.png 591w, https://zappysys.com/blog/wp-content/uploads/2016/01/read-multiple-array-from-json-data-file-300x149.png 300w" sizes="(max-width: 591px) 100vw, 591px" /></a><p id="caption-attachment-322" class="wp-caption-text">Read array from JSON data &#8211; Reading multiple array or single array</p></div>
<h3>Method-3: Use Array Flattening Option (Preferred for smaller arrays)</h3>
<p>If you have array inside extracted record and you like to flatten it so each items of array becomes column then use newly introduced feature [<strong>Enable Array Flattening</strong>]
<p>Consider JSON like below. What if you don&#8217;t like to store every detail from below JSON in just one table (i.e. rather than splitting in 3 tables Customers, CustomerHobbies , CustomerAddresses ?) . To achieve full denormalization ZappySys offers powerful yet simple one click option.</p><pre class="crayon-plain-tag">{
	"Customer" : [{
			"Name" : "John",
			"Hobby" : ["Painting","Reading","Swimming"],
			"Addresses" : [
				{"Street":"100 Main St","ZipCode":"10062"}, 
				{"Street":"101 Fire St","ZipCode":"11121"}
			]
		}, {
			"Name" : "Peter",
			"Hobby" : ["Hiking","Golf"],
			"Addresses" : [
				{"Street":"200 Main St","ZipCode":"20062"}, 
				{"Street":"201 Fire St","ZipCode":"33321"}
			]
		}
	]
}</pre><p>
To enable flattening check below option on Filter</p>
<div id="attachment_4760" style="width: 857px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/json-array-flattening-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4760" class="size-full wp-image-4760" src="https://zappysys.com/blog/wp-content/uploads/2016/01/json-array-flattening-option.png" alt="JSON Array Flattening Option in SSIS JSON Source " width="847" height="551" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/json-array-flattening-option.png 847w, https://zappysys.com/blog/wp-content/uploads/2016/01/json-array-flattening-option-300x195.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/01/json-array-flattening-option-768x500.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></a><p id="caption-attachment-4760" class="wp-caption-text">JSON Array Flattening Option in SSIS JSON Source</p></div>
<p>&nbsp;</p>
<div id="attachment_4761" style="width: 454px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-columns-denormalize-array-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4761" class="size-full wp-image-4761" src="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-columns-denormalize-array-option.png" alt="Column after Array Flattening Option" width="444" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-columns-denormalize-array-option.png 444w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-columns-denormalize-array-option-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-json-source-columns-denormalize-array-option-300x300.png 300w" sizes="(max-width: 444px) 100vw, 444px" /></a><p id="caption-attachment-4761" class="wp-caption-text">Column after Array Flattening Option</p></div>
<p>&nbsp;</p>
<h2>Using JSON REST API Connector to parse JSON data</h2>
<p>If you want to access JSON data from REST API then you can use same JSON Source Connector.  All you have to do is rather than local file path c:\data\xyz.json change it to URL as below and you will be able to access and filter JSON data using same technique as above.</p>
<div style="width: 657px" class="wp-caption alignnone"><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-data-from-web-url.png"><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-data-from-web-url.png" alt="Get JSON data from URL (REST API JSON response)" width="647" height="574" /></a><p class="wp-caption-text">Get JSON data from URL (REST API JSON response)</p></div>
<h2>JSON Path for recursive data extract (Double dot expression)</h2>
<p>There will be a time when you dont know how many levels deep you have to go for data extract. See below example. We will to get all employees id and name from hierarchy. For that you can use double dot like below. As you can see there are many nested levels and we want to extract id and name from each level so data can be</p>
<p><strong>Expected Output</strong></p><pre class="crayon-plain-tag">id      name
-------------------------
100	Jeff (CEO)
200	Bob (VP Sales)
300	Kim (VP HR)
400	Kumar (VP Dev)
210	Ron (Sales Mgr)	
220	Akash (Sales Mgr)	
410	Den (Sr. Dev)	
420	Den (Sr. Dev)
411	Den (Jr. Dev)
412	Sita (Jr. Dev)</pre><p>
<strong>Sample Data</strong></p><pre class="crayon-plain-tag">{
  "employees": [
    {
      "id": 100,
      "name": "Jeff (CEO)",
      "employees": [
        {
          "id": 200,
          "name": "Bob (VP Sales)",
          "employees": [
            {
              "id": 210,
              "name": "Ron (Sales Mgr)"
            },
            {
              "id": 220,
              "name": "Akash (Sales Mgr)"
            }
          ]
        },
        {
          "id": 300,
          "name": "Kim (VP HR)"
        },
        {
          "id": 400,
          "name": "Kumar (VP Dev)",
          "employees": [
            {
              "id": 410,
              "name": "Den (Sr. Dev)",
              "employees": [
                {
                  "id": 411,
                  "name": "Den (Jr. Dev)"
                },
                {
                  "id": 412,
                  "name": "Sita (Jr. Dev)"
                }
              ]
            },
            {
              "id": 420,
              "name": "Den (Sr. Dev)"
            }
          ]
        }
      ]
    }
  ]
}</pre><p>
<strong>Configure JSON Source for Recursive Children Scan using Double Dot JSONPath</strong></p>
<p>Open JSON Source and configure like below.</p>
<p>Set Filter as $..employees[*] (Notice how we used double dots in expression. This does recursive scan for N number of levels)</p>
<div id="attachment_8960" style="width: 1214px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-extract-json-array-recursive-double-dot-jsonpath.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8960" class="size-full wp-image-8960" src="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-extract-json-array-recursive-double-dot-jsonpath.png" alt="JSON Path for recursive scan of nested array (many levels deep)" width="1204" height="788" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-extract-json-array-recursive-double-dot-jsonpath.png 1204w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-extract-json-array-recursive-double-dot-jsonpath-300x196.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-extract-json-array-recursive-double-dot-jsonpath-768x503.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-extract-json-array-recursive-double-dot-jsonpath-1024x670.png 1024w" sizes="(max-width: 1204px) 100vw, 1204px" /></a><p id="caption-attachment-8960" class="wp-caption-text">JSON Path for recursive scan of nested array (many levels deep)</p></div>
<h2>Parse Multi-Dimensional Array</h2>
<p>If you want to learn more how to parse Multi-Dimensional JSON arrays then check <a href="//zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">this article</a> full length article.</p>
<h3><strong>Sample JSON with Multi Dimensional array</strong></h3>
<pre class="crayon-plain-tag">{
  "columns" : ["Id", "FirstName", "IsActive"],
  "rows" : [ [1,"bob",true], [2,"sam",false], [3,"joe",true] ]
}</pre>
<h3><strong>Array Transformation Options for 2D array</strong></h3>
<p><a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1640" src="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png?resize=687%2C165" sizes="(max-width: 687px) 100vw, 687px" srcset="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png?w=687 687w, https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png?resize=300%2C72 300w" alt="" width="687" height="165" data-attachment-id="1640" data-permalink="//zappysys.com/blog/parse-multi-dimensional-json-array-ssis/ssis-parse-json-array-pattern-1-select-2d-transformation/#main" data-orig-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png?fit=687%2C165" data-orig-size="687,165" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-parse-json-array-pattern-1-select-2d-transformation" data-image-description="" data-medium-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png?fit=300%2C72" data-large-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png?fit=687%2C165" /></a></p>
<p><strong>Sample JSON with Multi Dimensional array (No columns in document)</strong></p><pre class="crayon-plain-tag">{
  "rows" : [ [1,"bob",true], [2,"sam",false], [3,"joe",true] ]
}</pre><p>
<strong>Array Transformation Options for 2D array</strong></p>
<p><img decoding="async" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-2d-transformation.png" /></p>
<h2>Performance Tips</h2>
<p>In this section we will describe how to make your things faster.</p>
<h3>Reduce number of requests to server by changing page size</h3>
<p>If you are doing <a href="//zappysys.com/blog/odata-paging-rest-api-paging-using-ssis-json-source/" target="_blank" rel="noopener">REST API paging to get full resultset </a> then make sure you adjust page size to appropriate number so total requests sent to server is reduced. Each request to server adds overhead. Most of API supports page size parameter. Refer to your API documentation how to adjust page size.</p>
<h3>Avoid multiple REST API Round trips by caching response</h3>
<p>If you extracting multiple arrays from REST API response using above technique then we recommend you to use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task </a>so save response to File or variable first and then use cached JSON data multiple times. This approach is not as friendly as others but it can certainly reduce your total API requests.</p>
<h3>Use GZip compression</h3>
<p>If your REST API supports GZip compression then check Enable Gzip on Advanced tab of <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source (File, REST API Connector).</a> This will compress response in Gzip format from server and when it comes to your server it will be automatically decompressed by JSON Source connector. This seeds up thing significantly if you have lots of data to download.</p>
<h3>Uncheck include parent columns if not needed</h3>
<p>By default JSON Source connect includes parent column (Level above last property in filter) from the Filter path you specify. For Example  if you specify $.store.employees[*] and &#8220;Include parent columns&#8221; checked then It will extract all employees and then also include parent level columns for store (Tip: Parent column name start with P_ by default) . If you don&#8217;t need parent columns then uncheck from output, this reduces many steps during data extract process.</p>
<h2>Download sample package</h2>
<p><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/JsonXmlMultiOutputDemo_ParserTransform_2012.zip">Click here to download SSIS 2012 Package</a> (Will work in SSIS 2014, 2016)</p>
<h2>Conclusion</h2>
<p>In this post you learned how to extract data from JSON array and how to make data extract fast. Download <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source (File, REST API Connector)</a> to try everything listed above.</p>
<p>The post <a href="https://zappysys.com/blog/extract-read-multiple-arrays-from-json-data-file-rest-api-response/">Reading JSON Arrays from file / REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>JSONPath Expression Examples &#8211; JSON Cheatsheet (SSIS / ODBC)</title>
		<link>https://zappysys.com/blog/jsonpath-examples-expression-cheetsheet/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 21 Oct 2015 23:17:00 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS Tips & How-Tos]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonpath]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[Regular Expression]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=75</guid>

					<description><![CDATA[<p>What is JSONPath expression JSONPath expression is an expression language to filter JSON Data. Its a similar concept to XPath expression in XML but has limited features compared to XPath. If you are extracting data from REST API Services using SSIS JSON / XML Source or ODBC JSON / XML Driver then you will quickly realize [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/jsonpath-examples-expression-cheetsheet/">JSONPath Expression Examples &#8211; JSON Cheatsheet (SSIS / ODBC)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>What is JSONPath expression</h2>
<p style="text-align: left;"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-180x180.png"><img loading="lazy" decoding="async" class=" wp-image-2223 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-180x180.png" alt="" width="86" height="86" /></a><a href="https://goessner.net/articles/JsonPath/" target="_blank" rel="noopener">JSONPath</a> expression is an expression language to filter JSON Data. Its a similar concept to XPath expression in XML but has limited features compared to XPath. If you are extracting data from REST API Services using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON / XML Source</a> or <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" target="_blank" rel="noopener">ODBC JSON / XML Driver</a> then you will quickly realize that it&#8217;s very important to extract nested data by navigating to a certain level.</p>
<h2></h2>
<h2></h2>
<p>&nbsp;</p>
<h2>Sample data for JSONPath expression</h2>
<p>All examples of JSONPath expression in this post will use the following sample JSON for reference.</p>
<div>
<pre class="crayon-plain-tag">{
  "store": {
    "books": [
      {
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95,
        "sections": ["s1", "s2", "s3"],
        "publicationDay": "2023-05-10"
      },
      {
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99,
        "sections": ["s4", "s1", "s3"],
        "publicationDay": "2022-08-10"
      },
      {
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99,
        "sections": ["s1"],
        "publicationDay": "1851-10-11"
      },
      {
        "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99,
        "sections": ["s8", "s9"],
        "publicationDay": "1954-07-12"
      }
    ],
    "time": {
      "starttime": "8:00",
      "endtime": "18:00"
    }
  }
}</pre>
</div>
<h2>JSONPath Examples</h2>
<pre class="crayon-plain-tag">//get all books for store
$.store.books[*]
                     
//get all sections from all books
$.store.books[*].sections[*]     

//get all authors of all books for store
$.store.books[*].author  
             
//get 3rd book record 
$.store.books[2]    

//get first 2 books from the top
$.store.books[:2]   

//get last 2 books
$.store.books[-2:]
  
//get all books where author attribute equals to 'sam'
$.store.books[?(@author=='Nigel Rees')] 

//get all documents / sub documents (any level) where author attribute equals to 'sam'
$..[?(@author=='Nigel Rees')] 

//get books where price is less than 10
$.store.books[?(@.price&lt;10)] 

//filter all books with tag
$.store.books[?(@.tag)]

//find all books which contains section s1 or s2 (Use of Logical operator OR ( || )
$.store.books[?(@.sections[*]=='s1' || @.sections[*]=='s2' )]

//find all books where first section is s1 and second section is s2 (Logical operator OR ( &amp;&amp; )
$.store.books[?(@.sections[0]=='s1' &amp;&amp; @.sections[1]=='s2' )]

// Find all books where the publication day is before 2000-01-01
$.store.books[?(@.publicationDay &lt; '2000-01-01')]</pre>
<h2>JSON Path &#8211; Using Regular Expressions (Regex)</h2>
<p>The new version of SSIS PowerPack and ODBC PowerPack Supports Regular expressions in the path. Learn more about Regular expressions <a href="https://zappysys.com/blog/using-regular-expressions-in-ssis/" target="_blank" rel="noopener">check this article</a></p><pre class="crayon-plain-tag">//Using Regular Expression: get all books where author attribute contains 'Nigel' or 'Waugh'
//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/
$.store.books[?(@author=~ /Nigel|Waugh/  )] 

//Using Regular Expression: get all books where category is 'reference' OR author attribute contains 'Nigel' or 'Waugh'
$.store.books[?(@category=='reference' || @author=~ /Nigel|Waugh/ )] 

//Using Regular Expression: get all books where category is 'reference' AND author attribute contains 'Nigel' or 'Waugh'
$.store.books[?(@category=='reference' &amp;&amp; @author=~ /Nigel|Waugh/ )] 

//Using Regular Expression: get all books where author name either start with 'Nigel' (see ^ prefix) or ends with 'Waugh' (see $ suffix)
//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/
$.store.books[?(@author=~ /^Nigel|Waugh$/  )] 

//Using Regular Expression: get all books where author name starts with 'Nigel'
//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/
$.store.books[?(@author=~ /^Nigel/  )] 

//Using Regular Expression: get all books where author name ends with 'Waugh'
//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/
$.store.books[?(@author=~ /Waugh$/  )]</pre><p>
<h2>JSON Path &#8211; Nested Scan for any level (double dots)</h2>
<p>Now lets look at example of below JSON. Assume that you like to extract information from all nested &#8220;<strong>children</strong>&#8221;  nodes (basically extract id and name of every child from any level).</p>
<p>You can use double dots without specifying parent heirarchy like below to scan recusrsivly.</p>
<pre class="crayon-plain-tag">$..children[*]</pre>
<div>
<pre class="crayon-plain-tag">{
  "children": [
    {
      "id": 1,
      "name": "c1",
      "children": [
        {
          "id": 2,
          "name": "c2",
          "children": [
            {
              "id": 3,
              "name": "c3",
              "children": [
                { "id": 4, "name": "c4" },
                { "id": 5, "name": "c5" }
              ]
            }
          ]
        }
      ]
    }
  ]
}</pre>
</div>
<p>For this you can write following JSON Path</p>
<pre class="crayon-plain-tag">$..children[*]</pre>
<p>OR (below to find all children where name is c1 or c2 or c3)</p>
<pre class="crayon-plain-tag">$..children[?(@name=~ /c1|c2|c3/ )]</pre>
<p>Here is an example of a JSON Driver in ODBC. The same expression can be used in SSIS too.</p>
<div id="attachment_11483" style="width: 835px" class="wp-caption alignleft"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/JSON-ODBC-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11483" class="wp-image-11483 size-full" src="https://zappysys.com/blog/wp-content/uploads/2015/10/JSON-ODBC-example.png" alt="ODBC JSON Driver - Using Filter with Regular Expressions / JSONPath" width="825" height="784" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/JSON-ODBC-example.png 825w, https://zappysys.com/blog/wp-content/uploads/2015/10/JSON-ODBC-example-300x285.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/JSON-ODBC-example-768x730.png 768w" sizes="(max-width: 825px) 100vw, 825px" /></a><p id="caption-attachment-11483" class="wp-caption-text">ODBC JSON Driver &#8211; Using Filter with Regular Expressions / JSONPath</p></div>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2></h2>
<h2>JSONPath for Root Objects in Array</h2>
<p>Now lets look at another pattern of JSON where your documents are on the first level rather than under some array property. Root filter only works if you have a version released after Dec-29-2021. Previous version didn&#8217;t support filtering on Root Array.</p>
<p><strong>Example JSON</strong></p><pre class="crayon-plain-tag">[
 { id:1 , color:'red'},
 { id:2 , color:'red'},
 { id:3 , color:'blue'},
 { id:4 , color:'green'}
]</pre><p>
<strong>Example JSON Path Filters</strong></p><pre class="crayon-plain-tag">$.[0]  //Extract first document
$..[?(@color=='red')]   //Recursive scan (any level) - Extract all documents where color=red use 2 dots after $ for filter</pre><p>
<strong>NOTE:</strong> using two dots after $ (e.g. <strong>$..[zzzz]</strong>) invokes nested scan so any level array will return documents, this may not be the acceptable case sometimes but if you want to filter the root array then this is the only way for now in ZappySys.</p>
<p>If you must not allow recursive scan then you can use the following two properties</p>
<p>EnableRawOutputModeSingleRow = true;<br />
RawOutputDataRowTemplate = &#8220;{data: [$1] }&#8221;  &#8211;where [$1] is replaced at runtime with Document Text you like to parse (can be static or URL response)</p>
<p>OR</p>
<p>Use functions in RawOutputDataRowTemplate if needed</p>
<p>RawOutputDataRowTemplate = &#8220;{data: &lt;&lt;[$1],FUN_BASE64DEC&gt;&gt;}&#8221;</p>
<p>The above will wrap around the actual JSON / XML you need to parse so now after this setting you can use JSONPath = $.data[?(@id==1)] to avoid two dots to prevent a recursive scan</p>
<p>The post <a href="https://zappysys.com/blog/jsonpath-examples-expression-cheetsheet/">JSONPath Expression Examples &#8211; JSON Cheatsheet (SSIS / ODBC)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
