Get Nth String JK๐
Get Nth String JK
- string
- int
- float
- boolean
Somewhere in a real workflow, a list always ends up as a comma-separated string - a JSON export, a prompt file, an array pasted into a text field. Get Nth String JK is the pocket index into those strings: give it "1.0, 2.0, 3.0" and an index, and it hands back the item as STRING, INT, FLOAT, and BOOLEAN on four outputs. One node, every type you might need downstream, no conversion ladder.
The mechanism is simple and predictable: the input is split on commas or newlines, the whitespace is stripped, and index selects the item. Two details make it friendlier than it looks:
- Negative indices count from the end.
index = -1is the last item, exactly like Python. That's the flag to reach for when you want "the last seed from this list" without knowing the length. - Type conversion is forgiving. The string output is always the raw item; INT and FLOAT try to parse and fall back to 0 / 0.0 if the text isn't numeric (so
"cat"becomes int 0 rather than an error); BOOLEAN recognizes the usual truthy/falsy strings -true,1,yes,onvsfalse,0,no,off- and otherwise uses Python truthiness. If your list is"yes, no, maybe", index 0 gives booleantrue, index 1 givesfalse.
That permissive conversion is both the feature and the trap: because INT/FLOAT never error, a typo silently yields 0. If a downstream KSampler suddenly gets zero steps, this node is a strong suspect - check that the list item actually parses.
Install. It's part of ComfyUI-JakeUpgrade:
cd ComfyUI/custom_nodes
git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
cd ComfyUI-JakeUpgrade
pip install -r requirements.txt
Or ComfyUI Manager โ "JakeUpgrade". Windows portable: install.bat or ../../../python_embeded/python.exe -s -m pip install -r requirements.txt. Restart. Light dependencies - no model downloads.
Gotchas: an out-of-range index raises a clear "Index X out of range" error rather than returning something empty - good for debugging, annoying in loops unless you bound your index. And because this node pairs naturally with the pack's Save/Load String List To/From JSON nodes (which turn file-backed lists into exactly this comma-joined format), you'll often see all three together in Jake's workflows. Pack rules: LOAD_DEPRECATED_NODES = True if JK nodes come up missing, disable ComfyUI MultiGPU per the README for CUDA-error avoidance.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| string_list | STRING | 1.0, 2.0, 3.0 | Comma-separated list of values |
| index | INT | 0-1โ100 | Index of item to retrieve (negative values count from end) |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| string | STRING | โ |
| int | INT | โ |
| float | FLOAT | โ |
| boolean | BOOLEAN | โ |