Visit ComfyUI Online for ready-to-use ComfyUI environment
The JSONOutputList node extracts and compiles JSON data using JSONPath, simplifying data handling.
The JSONOutputList node is a versatile utility designed to extract and compile data from JSON objects using JSONPath syntax. This node is particularly useful for AI artists who need to manipulate and analyze JSON data without delving into complex programming. By leveraging JSONPath, a query language for JSON, you can easily extract arrays or dictionaries from JSON objects and flatten them into a single list. This node also allows you to create objects from literal strings, such as [1, 2, 3], making it a powerful tool for data transformation and analysis. The JSONOutputList node simplifies the process of handling JSON data, enabling you to focus on creative tasks while ensuring data is organized and accessible.
The jsonpath parameter specifies the JSONPath expression used to extract values from the JSON data. It determines which parts of the JSON object will be selected and processed. The default value is $.dict, which targets a dictionary within the JSON structure. This parameter is crucial for directing the node to the correct data within the JSON object, and understanding JSONPath syntax is essential for effective use.
The json parameter is a JSON string that will be parsed into an object. It serves as the primary data source for the node. The default value is a formatted JSON string containing a dictionary and an array: { "dict" : { "a": 0.12, "b": 3.45, "c": 6.78 }, "arr": [0.12, 3.45, 6.78] }. This parameter can be multiline and acts as a placeholder for the JSON data you wish to process. It is important to ensure that the JSON string is correctly formatted to avoid parsing errors.
The obj parameter is an optional input that allows you to provide an object of any type to replace the JSON string. If specified, this object will be used instead of the JSON string for data extraction. This flexibility is useful when you have pre-processed data or when working with non-JSON data structures. If not provided, the node defaults to using the json parameter.
The key output provides the keys for dictionaries or indices for arrays as strings. It represents a global index of the flattened list for all non-key elements. This output is essential for identifying the position or name of each extracted element within the original JSON structure.
The value output returns the extracted values as strings. This output is crucial for accessing the actual data extracted from the JSON object, allowing you to use or manipulate these values in subsequent processes.
The int output converts the extracted values into integers. If a value is not a parseable number, it defaults to 0. This output is useful for numerical operations where integer values are required, providing a straightforward way to handle numeric data.
The float output converts the extracted values into floating-point numbers. Similar to the int output, non-parseable numbers default to 0. This output is important for precision-based calculations and operations involving decimal numbers.
The count output indicates the total number of items in the flattened list. It provides a quick overview of the number of elements extracted and processed, which can be useful for validation and analysis purposes.
The debug output offers a formatted JSON string of all matched objects, serving as a debug tool. This output is valuable for verifying the correctness of the JSONPath expression and understanding the structure of the extracted data.
obj parameter to directly input pre-processed data or non-JSON objects, providing flexibility in data handling.debug output to verify the accuracy of your JSONPath queries and ensure the correct data is being extracted.int or float outputs.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.