diff --git a/README.md b/README.md index 963c70e..bfeef9e 100644 --- a/README.md +++ b/README.md @@ -101,24 +101,115 @@ git clone https://github.com/ethanfel/ComfyUI-JSON-Dynamic.git ## JSON Format -Works with flat JSON or `batch_data` arrays: +### Flat JSON (single segment) + +For simple use cases, the node reads keys directly from the root object. The `sequence_number` input is ignored. + +```json +{ + "general_prompt": "A cinematic scene...", + "seed": 42, + "flf": 0.5, + "camera": "pan_left" +} +``` + +### Batch JSON (multiple segments) + +For multi-shot workflows, wrap entries in a `batch_data` array. Each entry is a **segment** representing one shot/scene with its own settings. The `sequence_number` input selects which segment to read. ```json { "batch_data": [ { "sequence_number": 1, - "general_prompt": "A cinematic scene...", + "general_prompt": "Wide establishing shot of a city", "seed": 42, - "flf": 0.5, + "camera": "static", + "flf": 0.0 + }, + { + "sequence_number": 2, + "general_prompt": "Close-up of the protagonist", + "seed": 108, "camera": "pan_left", - "my_custom_key": "any value" + "flf": 0.5, + "my_custom_key": "only on this segment" + }, + { + "sequence_number": 3, + "general_prompt": "Aerial drone shot over rooftops", + "seed": 77, + "camera": "zoom_in", + "flf": 0.8 } ] } ``` -Without `batch_data`, reads keys directly from the root object. +### Segment lookup + +The node resolves which segment to read using this logic: + +1. **Match by `sequence_number` field** — scans `batch_data` for an entry whose `sequence_number` matches the input +2. **Fallback to array index** — if no match is found, uses `sequence_number - 1` as the array index (clamped to bounds) +3. **No `batch_data`** — reads keys from the root object directly + +This means segments don't need to be in order and can have gaps (e.g. 1, 5, 10). Each segment can have different keys — click **Refresh Outputs** after changing `sequence_number` if the keys differ between segments. + +
+ +
## License