Nodes/comfyui_LLM_party/JSON Get Value🐶
ComfyUI Node

JSON Get Value🐶

Pull one field out of a JSON string already in your graph

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
JSON Get Value🐶
    • any
    text
    key
    is_enabletrue

    Prompt an LLM to answer in JSON and you'll get back a blob of structured text - useful, but not directly wireable into a downstream socket that wants just one field of it. JSON Get Value is comfyui_LLM_party's tool for that exact moment: hand it JSON text and a key, and it hands back that field's value, typed to match whatever's actually there.

    The distinction from its sibling JSON File Parser matters: that one reads from a file on disk. This one reads JSON that's already flowing through your graph as a string - the normal shape of an LLM's structured output, or anything else that produced JSON text mid-workflow rather than saving it to a file first.

    How it works

    Give it text (the raw JSON string) and key (which field to extract), and it parses the text and returns the value at that key. No file I/O, no disk access - pure in-memory parsing of whatever string reached this node.

    The inputs and outputs that matter

    • text - the JSON string to parse. Usually piped straight from an LLM node's output, or from this pack's text2json node if you built the JSON yourself from plain text.
    • key - the field name to pull out.
    • is_enable - the pack's standard bypass toggle.

    Output: any - typed as ComfyUI's wildcard *, so it connects to whatever socket actually matches the value's real type: a STRING, an INT, a FLOAT, a nested LIST. You don't need a separate converter per data type.

    Where it fits

    This is the pattern the community converged on for a real reason: JSON gives an LLM's output clean separation between fields in a way a wall of prose doesn't, and this node - paired with prompting the model to answer in a specific JSON shape - is how you turn that structured response into individual values you can actually route through the rest of your graph. It's the read half of the pack's JSON toolkit; text2json and custom_persona's templating are further up the chain building the text this node then reads back apart.

    How to install it

    Search comfyui_LLM_party in ComfyUI Manager and install, then restart. Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heshengtao/comfyui_LLM_party.git
    

    Run pip install -r requirements.txt from inside the pack's folder using ComfyUI's own Python, then restart. This node is pure text parsing with no dependencies of its own - the pack's heavier install requirements (LLM clients, embeddings, OCR, TTS) belong to other nodes sharing the same combined requirements.txt.

    Common issues & troubleshooting

    It errors out on an LLM's output specifically. This is the most common failure mode for this node in practice: models don't always emit perfectly valid JSON even when instructed to - a stray comment, markdown code fences around the JSON, a trailing comma. Route the LLM's raw text through this pack's JSON Repair node before this one if you're seeing intermittent parse failures rather than a consistent, fixable prompt problem.

    any comes back empty even though the JSON looks fine. key has to match exactly, including case, against a real field in the parsed object. If your data is nested a level or two deep, a flat top-level key lookup won't reach it - check the actual structure of what the LLM returned rather than assuming the shape you asked for is the shape you got.

    You need multiple fields, not just one. This node only pulls one key per call - for several fields from the same JSON, use one node per key, or reach for a node built to unpack a whole object at once if this pack has one for your case.

    Category大模型派对(llm_party)/转换器(converter)

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    keySTRING
    is_enableBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    any*