A custom node for ComfyUI to parse and extract data from JSON strings.
A collection of custom nodes for ComfyUI to manipulate and process JSON data.
为ComfyUI提供的一套JSON数据处理节点集合。
cd ComfyUI/custom_nodes/
git clone [email protected]:Q-Bug4/Comfyui-Json-Nodes.git
json_string
: JSON stringpath
: Data path (optional)parsed_data
: Parsed JSON or specific valuearray_size
: Size if result is arrayjson_input
: JSON stringmax_depth
: Maximum depth for random selectionrandom_value
: Randomly selected valuejson_input
: JSON objectindex
: Current indexmode
: Iteration mode (fixed/incr/decr)key
: Current keyvalue
: Current valuecurrent_index
: Current positiontotal_items
: Total number of itemsjson_input
: JSON arrayindex
: Current indexmode
: Iteration mode (fixed/incr/decr)item
: Current itemcurrent_index
: Current positiontotal_items
: Total number of itemsjson_input_1
: First JSONjson_input_2
: Second JSONmerge_strategy
: Override/Preserve/Concatmerged_json
: Combined JSON resultjson_input
: JSON to modifypath
: Path to modifynew_value
: New valuemodified_json
: Updated JSONkey_value_pairs
: Key-value pairsis_array
: Generate array instead of objectgenerated_json
: New JSON structurejson_input
: JSON inputlength
: Number of itemsjson_input
: JSON objectkey
: Key to checkexists
: Boolean resultvalue
: Value if existsjson_input
: JSON inputindent
: Indentation spacessort_keys
: Sort keys alphabeticallyjson_string
: Formatted JSON stringobject.nestedObject.property
array[0]
or array.0
object.array[2].property
# Input JSON
{
"users": [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25}
]
}
# Using Array Iterator with mode="incr"
# Will output each user object in sequence
# First input
{"name": "John", "age": 30}
# Second input
{"age": 31, "city": "New York"}
# Result with strategy="override"
{"name": "John", "age": 31, "city": "New York"}
# Input JSON
{
"colors": ["red", "blue", "green"],
"sizes": {"S": 10, "M": 20, "L": 30}
}
# Random value might return any color or size value
ValueError is raised for:
Improvements are welcome! Steps:
MIT License. See LICENSE file for details.