Nodes/ComfyUI_Text_Tools_SG/Text Tools Load Text Json md-SG
ComfyUI Node

Text Tools Load Text Json md-SG

Pull a prompt or JSON file off disk into your graph without copy-paste

By ShammiG·Created 9 months ago·Updated 6 months ago· 7
Text Tools Load Text Json md-SG
    • text_content
    folderinput
    file
    info_textSupports .txt, .json, and .md files. comfyui_root is where you run comfy from. output_text is a folder named text if present in ouput folder.

    The moment you have a prompt library or a config file you keep reusing, copy-paste stops being fine and becomes a chore you'll mess up. Text Tools Load Text Json md-SG reads a .txt, .json, or .md file from a folder you pick and hands its contents to the graph as a STRING - no copy, no paste, no retyping. If you keep prompt templates or workflow configs as files on disk, this is the node that wires them in.

    It's from the small ShammiG/ComfyUI_Text_Tools_SG pack (the same author as the markdown Editor), and it's one of two loaders in the pack. This one picks files from a curated list of ComfyUI's own folders; the sibling "Load Text … From Anywhere (FilePath)" node takes an absolute path instead.

    The inputs that matter

    • folder - a dropdown limited to the places you're most likely to keep text: input, output, output_text (a text subfolder inside your output folder - where this pack's Save node writes), temp, and comfyui_root (the folder you launched ComfyUI from). Default is input.
    • file - a dropdown of the .txt/.json/.md files found in that folder. The list refreshes when you change the folder, thanks to a small API endpoint the pack registers. Empty? Drop a file into ComfyUI/input and refresh.
    • info_text - an informational multiline field with the author's own notes. It exists so the node carries its documentation on the canvas; you can ignore it or edit it.

    The single output, text_content, is the file's contents as one STRING - wire it into a CLIP Text Encode, a Save Text node, a merge node, anything that eats text.

    How it works

    Straightforward file reading: it resolves the folder to a real path, loads the file with UTF-8 encoding, and - the nice touch - if it's a JSON file, it re-serializes the parsed content with indent=2 and ensure_ascii=False, so you get readable, properly-indented JSON instead of a wall of text. It validates extensions and returns a clear error message as its output if a file goes missing (as a string, not a crash). It also tracks the file's modification time so the node re-runs when the file on disk changes - a genuinely useful behavior: edit your prompt file in any editor, hit Queue, and the new text flows through without touching the graph.

    Install and gotchas

    Same as every node in this pack - Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ShammiG/ComfyUI_Text_Tools_SG
    

    then restart. No pip dependencies, no models, no GPU requirement. The author's README warning applies pack-wide: on ComfyUI 0.3.76+ keep Nodes 2.0 disabled, since the custom frontend widgets aren't ported to the new renderer. The loader's backend will still work regardless, but the file-list dropdown lives in the frontend, so it's the first thing that breaks.

    One practical gotcha specific to this node: the file list is only as fresh as the last refresh, and files with non-ASCII names render fine but are matched exactly - rename a file and you'll get a "File not found" string in the output until the list catches up. And output_text only exists if there's actually a text folder inside ComfyUI/output, so if it's empty in the dropdown, that's why.

    For a utility node this is pleasantly polished: pick a folder, pick a file, done. The JSON pretty-printing and the change-detection are the two features that make it worth having over a plain text loader.

    Categoryutils

    Inputs (3)

    NameTypeDefaultDescription
    folderCOMBOinput5 options: comfyui_root, input, output, output_text, temp
    fileCOMBO1 options:
    info_textSTRINGSupports .txt, .json, and .md files. comfyui_root is where you run comfy from. output_text is a folder named text if present in ouput folder.

    Outputs (1)

    NameTypeDescription
    text_contentSTRING