JSON Extractor Node
This node is designed to extract specific pieces of information from a JSON object based on a structured set of parameters provided to the node. It’s particularly useful for dealing with complex, nested JSON data structures, allowing users to specify exactly which data should be extracted at various levels of the JSON hierarchy.
Inputs
JSON: The JSON object from which data will be extracted. This input expects a JSON object or array.
Params: The parameters defining which parts of the JSON object to extract. This input expects an array of parameter objects, each specifying a key in the JSON data and any sub-keys that should be extracted from the associated value.
Output
Output: The extracted data, structured according to the provided parameters. The output will mirror the structure defined in the ‘Params’ input, containing only the keys and sub-keys specified for extraction.
Properties
No configurable properties are available for this node. The extraction logic is entirely driven by the ‘Params’ input.
Usage
To use the JSON Extractor Node:
- Connect a JSON object or array to the ‘JSON’ input.
- Define your extraction parameters as an array of objects, each specifying a ‘key’ to extract and, optionally, ‘subkeys’ for nested data extraction. Connect this parameter array to the ‘Params’ input.
- The node will process the inputs and output the extracted data according to your parameters.
This node simplifies the process of extracting specific information from complex JSON structures, making it easier to transform, analyze, and visualize JSON data within your graph.
Example
Suppose you have the following JSON object:
To extract the titles of all posts and the content of the first comment of each post for the first user, you would use the following parameters:
Connect this parameter array to the ‘Params’ input, and the JSON object to the ‘JSON’ input. The output will be:
This example demonstrates how to use the JSON Extractor Node to navigate through nested arrays and objects to retrieve specific pieces of data based on your requirements.