Stream JSON File Reader
Discover more about the Stream JSON File Reader component and how to use it on the Digibee Integration Platform.
Stream JSON File Reader reads a local JSON file, applies a JSON Path expression, returns a JSON structure according to the defined expressions and triggers subpipelines to process each message. The component is to be used for large files.
Parameters
Take a look at the configuration parameters of the component. Parameters supported by Double Braces expressions are marked with (DB)
.
Parameter | Description | Default value | Data type |
---|---|---|---|
File Name | File name or full file path (i.e. tmp/processed/file.json) of the local JSON file. | data.json | String |
JSON Path | JSON Path expression that determines how the JSON file stream reading will occur. | $ | String |
Element Identifier | Attribute that will be sent in case of errors. | data | String |
Parallel Execution Of Each Iteration | Occurs in parallel with the loop execution. | False | Boolean |
Fail On Error | When active, this parameter suspends the pipeline execution if there’s a severe occurrence in the iteration structure, disabling its complete conclusion. The Fail On Error parameter activation doesn’t have any connection with the errors occurred in the components used for the construction of the subpipelines (onProcess and onException). | False | Boolean |
Messages flow
Input
No specific input message is expected, but the existence of a JSON file in the pipeline local directory and the filling of the File Name and JSON Path fields for the file processing.
Output
total: total number of processed lines.
success: total number of successfully processed lines.
failed: total number of lines whose process failed.
When the lines are correctly processed, their respective subpipelines return { "success": true }
for each of them.
The component throws an exception if the File Name doesn’t exist or can’t be read.
The files manipulation inside a pipeline occurs in a protected way. All the files can be accessed with a temporary directory only, where each pipeline key gives access to its own files set.
Stream JSON File Reader makes batch processing. To better understand the concept, read the article about Batch processing.
Stream JSON File Reader in action
Making the file stream with no filters in JSON Path
Input
file.json
File Name: file.json
JSON Path: $.products[*]
Ouput
Each object inside the "products" array of the informed file will be processed in an independent way:
First subflow
Second subflow
Third subflow
Forth subflow
Making the file stream with filters in JSON Path
Input
file.json
File Name: file.json
JSON Path: $.products[?(@.price < 80)]
Output
Each object inside the "products"
array of the informed file will be processed in an independent way:
First subflow
Second subflow
Making the file stream with filters in JSON Path and returning the ‘product’ attribute value only
Input
file.json
File Name: file.json
JSON Path: $.products[?(@.price < 80)].product
Ouput
Each object inside the "products"
array of the informed file will be processed in an independent way:
First subflow
Second subflow
Last updated