On this page
Table of Contents | ||||
---|---|---|---|---|
|
Snap type: | Transform | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: | This Snap splits a list of values into separate JSON documents in its output view.
| |||||||||||||
Prerequisites: | [None] | |||||||||||||
Support and limitations: | Works in Ultra Pipelines. | |||||||||||||
Account: | Accounts are not used with this Snap. | |||||||||||||
Views: |
| |||||||||||||
Settings | ||||||||||||||
Label* | The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. | |||||||||||||
JSON Path to Split* | Defines a path to the list that holds the document entries. Each entry of the list will be written out as a separate document. Enter the JSON path manually. Alternatively, click the Suggestion icon to view the list of paths and select the required path. Default value: None Examples:
| |||||||||||||
Include scalar parents | Enables you to include scalar parents in each output document.
Using the split path on
doc 2:
Enabling Include scalar parents will lead to:
doc 2:
Default value: Deselected | |||||||||||||
Null-safe access | Allows to skip invalid path definitions that are defined in the Include Paths property below. The Snap will throw a DataException if disabled when the path does not exist in the input view. Default value: Deselected | |||||||||||||
Include Paths | Allows to include objects from the input document in the resulting output document(s) doc1:
| |||||||||||||
Exclude List from Output Documents | Select the checkbox to prevent the list that is split from getting included in output documents. Selecting this checkbox improves memory usage. Default Value: N/A | |||||||||||||
Show Null Values for Include Paths | Select the checkbox to show key-value entries of the null values for the objects added to the Include Paths field in the output documents. Default Value: N/A | |||||||||||||
|
|
Examples
Assume a Pipeline starts with File Reader + JSON Parser + JSON Splitter.
The File Reader reads a JSON file with the following contents:
Code Block |
---|
{ "customer":"ACME", "orders":[ { "ordernumber":"01", "orderdate":"20131122", "orderlines":[ { "prod":"p1", "price":"23" }, { "prod":"p2", "price":"13" }, { "prod":"p3", "price":"231" } ], "city":"san mateo" }, { "ordernumber":"02", "orderdate":"20131222", "orderlines":[ { "prod":"w1", "price":"123" }, { "prod":"e2", "price":"3" }, { "prod":"q3", "price":"31" } ], "city":"burlingame" } ] } |
If the JSON path in the JSON Splitter is set to:
$orders[*].orderlines
The data output would look something like:
Code Block |
---|
[ { "prod": "p1", "price": "23", "orderdate": "20131122", "ordernumber": "01", "customer": "ACME", "city": "san mateo" }, { "prod": "p2", "price": "13", "orderdate": "20131122", "ordernumber": "01", "customer": "ACME", "city": "san mateo" }, { "prod": "p3", "price": "231", "orderdate": "20131122", "ordernumber": "01", "customer": "ACME", "city": "san mateo" }, { "prod": "w1", "price": "123", "orderdate": "20131222", "ordernumber": "02", "customer": "ACME", "city": "burlingame" }, { "prod": "e2", "price": "3", "orderdate": "20131222", "ordernumber": "02", "customer": "ACME", "city": "burlingame" }, { "prod": "q3", "price": "31", "orderdate": "20131222", "ordernumber": "02", "customer": "ACME", "city": "burlingame" } ] |
See Also
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|