JSON Splitter

Overview

You can use this Snap to split a list of values into separate JSON documents in its output view. It captures metadata and lineage information from the input document.


JSON Splitter Configuration Settings

Prerequisites

None.

Limitations and known issues

None.

Snap views

View Description Examples of upstream and downstream Snaps
Input JSON data to be split, in the form of a JSON array. MapperJSON Generator
Output This Snap has exactly one document output view, where it provides the JSON document data stream. MapperCopy
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • Expression icon (): Allows using JavaScript syntax to access SnapLogic Expressions to set field values dynamically (if enabled). If disabled, you can provide a static value. Learn more.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field / Field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: JSON Splitter

Example: Document Split
JSON Path to Split String/Suggestion

Required. Enter the JSON path manually. Alternatively, click the Suggestion Suggestible icon to view the list of paths and select the required path. Defines a path to the list that holds the document entries. Each entry of the list will be written out as a separate document.

Note: The Snap automatically prefixes jsonPath to the value.
Note: Dynamic JSON PathYou can also include pipeline parameters in this property to be dynamic so that it picks values from the pipeline's properties. Use parentheses inside the square brackets to specify the pipeline parameter. For example, the JSON Path $orders[*].orderlines[*]can be written as $orders[*].[(_object)] where object is the pipeline parameter containing the value orderlines.

Default value: N/A

Example:

jsonPath($, "orders[*].orderlines")

jsonPath($, "orders[*].orderlines[*].prod")

Include scalar parents Checkbox Required. Select this checkbox to include scalar parents in each output document.

Example input:

{ 
          "add 1 data": [ 
          { 
               "a": 1, "b": 2 }, { 
               "a": 3, "b": 4 } 
          ], "add 2 data": [ 
                  { 
                    "a": 11, "b": 22 }, { 
                    "a": 33, "b": 44 } 
          ], 
          "id": 111 }
Using the split path on "add 1 data" will create 2 output documents.doc 1:
{
            "a": 1,
             "b": 2 }
doc 2:
{
           "a": 3,
           "b": 4 }
Enabling Include scalar parents will lead to:doc 1:
{
    "a": 1,
    "b": 2,
    "id": 111 }
doc 2:
{
    "a": 3,
    "b": 4,
    "id": 111 }

Default status: Deselected

Null-safe access Checkbox

Required. Select this checkbox to skip invalid path definitions that are defined in the Include Paths property below. If disabled when the path does not exist in the input view, the Snap displays a DataException.

Default status: Deselected

Example: $['@DESCRIPTION']
Include Path String/Suggestion Specify the path to include objects from the input document in the resulting output document(s).
Note: If the key name of the included object already exists in the output document(s), its value is overwritten in the output document(s). To prevent the value from being overwritten, you can add the Mapper Snap (upstream of JSON Splitter Snap) to modify the key name of the included object.
For example, a path such as ['add 2 data'] will include the object in the output documents:

doc:1

{
    "a": 1,
    "b": 2,
    "id": 111,
    "add 2 data": [
        {
            "a": 11,
            "b": 22
        },
        {
            "a": 33,
            "b": 44
        }
    ],
}
doc2:
{
    "a": 3,
    "b": 4,
    "id": 111,
    "add 2 data": [
        {
            "a": 11,
            "b": 22
        },
        {
            "a": 33,
            "b": 44
        }
    ],
}

Default value: N/A

Exclude List from Output Checkbox Select this checkbox to prevent the split list from being included in output documents. Select this checkbox to leverage the memory usage.

Default status: Deselected

Show Null Values for Include Paths Checkbox

Select this checkbox to show key-value entries of the null values for the objects added to the Include Paths field in the output documents.

Default status: Deselected

Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate & Execute

Example: Execute only