<?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 parser transform Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/ssis-json-parser-transform/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/ssis-json-parser-transform/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 11 Dec 2024 15:24:27 +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 parser transform Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/ssis-json-parser-transform/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to extract multiple arrays from MongoDB using SSIS</title>
		<link>https://zappysys.com/blog/how-to-extract-multiple-arrays-from-mongodb-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 12 Jan 2017 18:30:53 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB Source]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json parser transform]]></category>
		<category><![CDATA[ssis multicast]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=940</guid>

					<description><![CDATA[<p>Since MongoDB Source supports only one output you cannot select two different hierarchies as your filter criteria. However solution is easy. You can perform following steps to achieve similar result without fetching data twice with multiple sources. Same steps described below can be applied for JSON Source (read more here) &#160; Steps &#8211; Extract multiple [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-extract-multiple-arrays-from-mongodb-using-ssis/">How to extract multiple arrays from MongoDB using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png"><img decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" /></a>Since <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-source/" target="_blank" rel="noopener">MongoDB Source</a> supports only one output you cannot select two different hierarchies as your filter criteria. However solution is easy. You can perform following steps to achieve similar result without fetching data twice with multiple sources. Same steps described below can be applied for <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> (read <a href="https://zappysys.com/blog/extract-read-multiple-arrays-from-json-data-file-rest-api-response/" target="_blank" rel="noopener">more here</a>)</p>
<p>&nbsp;</p>
<h2>Steps &#8211; Extract multiple arrays from MongoDB</h2>
<ol>
<li>Extract data using MongoDB source (Select output mode as Raw Document)</li>
<li>Connect MongoDB Source to Multicast Transform</li>
<li>Connect multi cast output to <a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a> which will take upstream raw JSON doc and convert to Flat table output just like MongoDB source. On Json Parser specify filter e.g. $.doc.<strong>Array1</strong>[*]</li>
<li>Connect Json Parser Transform output to desired target e.g. sql server/flat file.</li>
<li>Repeat step #3,4,5 for  as many outputs you need with different filter settings (e.g. $.doc.<strong>Array2</strong>[*]).</li>
</ol>
<p>Here is more info about JSON Parser Transform (This is new Transform added in v2.2)</p>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/">//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/</a></p>
<h2>Video Tutorial &#8211; Step By Step &#8211; How to read multiple MongoDB arrays</h2>
<p>Below video tutorial demonstrates following things</p>
<p>* How to execute MongoDB Shell commands in SSIS (e.g. create Collection)<br />
* How to read data from multiple arrays from MongoDB document (i.e. Orders, Products)<br />
* Save result into two SQL Server tables</p>
<a href="https://zappysys.com/blog/how-to-extract-multiple-arrays-from-mongodb-using-ssis/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FKtXRxlhBF5M%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/how-to-extract-multiple-arrays-from-mongodb-using-ssis/">How to extract multiple arrays from MongoDB using SSIS</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>
	</channel>
</rss>
