Nodes/Quality of Life Nodes for ComfyUI/Load Images From JSONArray (Soze)
ComfyUI Node

Load Images From JSONArray (Soze)

Four named image slots from a JSON list

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
Load Images From JSONArray (Soze)
    • image1
    • image2
    • image3
    • image4
    • remaining_images
    json_array
    prefix
    suffix

    If a JSON array is telling you which images to load - filenames from an API response, a manifest file, a config someone else generated - you don't want to hand-place four separate Load Image nodes and manually match each one to the right entry. Load Images From JSONArray takes the array once and gives you back the first four images as individually named outputs, plus a bucket for anything beyond that.

    The four-named-slots shape is a deliberate design, not an accident: it's built for workflows that need specific, addressable image slots - say, compositing four fixed reference images into one canvas - where you want to wire "the first image" and "the third image" to different places in the graph, rather than looping over an undifferentiated list.

    How it works

    json_array is your list - presumably of filenames or partial paths, since the node also takes prefix and suffix fields whose obvious purpose is building a full path around each entry (a common pattern: your JSON holds bare filenames, and prefix supplies the folder they live in while suffix adds a shared extension if the array entries don't already include one). It loads the first four resulting paths into the four named image outputs, and folds anything past the fourth into remaining_images as a single bucket.

    The inputs and outputs that matter

    • json_array - required, a JSON array as a string (not the multiline field - keep it on one line unless you've confirmed the node handles line breaks inside the value).
    • prefix - required, default empty string. Prepended to each array entry before loading - use this for a shared folder path if your array only holds bare filenames.
    • suffix - required, default empty string. Appended to each entry - use this for a shared file extension if your array entries omit it.
    • Output: image1 through image4 - the first four images, loaded and exposed as individually addressable outputs.
    • Output: remaining_images - whatever's left past the first four, if your array is longer.

    How to install it

    Through ComfyUI Manager (search "Quality of Life Nodes for ComfyUI" or "Soze") or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SozeInc/ComfyUI_Soze.git
    pip install -r ComfyUI_Soze/requirements.txt
    

    Restart ComfyUI. No models, no GPU dependency beyond loading the images themselves.

    Common issues & troubleshooting

    Only the first four images seem to actually connect to anything. That's the intended shape of this node - it's built for exactly-four addressable slots, not for an arbitrary-length loop. If you actually need to process an unknown-length list of images one at a time, this isn't the right node; Image List Loader or one of the pack's index-driven folder loaders fits that shape better.

    Paths don't resolve and you're not sure why. Check prefix and suffix first - since they're concatenated onto each raw array entry, a missing slash in prefix or an unexpected extension already present in the array (doubled up by suffix) is the most likely cause of a bad final path. Test with a one-item array and a Show Text node on the way to loading if you're not sure what the assembled path looks like.

    remaining_images behaves unexpectedly with fewer than four entries. If your array has three or fewer items, image4 (and possibly remaining_images) will have nothing to fill - treat those as expected empty outputs in that case rather than a sign something's broken, and make sure anything downstream can tolerate an empty slot.

    Categoryutils

    Inputs (3)

    NameTypeDefaultDescription
    json_arraySTRING
    prefixSTRING
    suffixSTRING

    Outputs (5)

    NameTypeDescription
    image1IMAGE
    image2IMAGE
    image3IMAGE
    image4IMAGE
    remaining_imagesIMAGE