Nodes/VLM_nodes/JSON to Text
ComfyUI Node Runs on cloud

JSON to Text

The glue that turns JSON-looking LLM output into text you can read

By gokayfem·Created 3 years ago·Updated 17 days ago· 585
JSON to Text
    • text
    • canonical_json
    • items
    text{}
    format_modeSmart readable (legacy compatible)
    json_path
    separator
    strip_generation_verbstrue

    The prompt-generation nodes in this pack return JSON-looking text, and JSON is not what you want sitting in a CLIP encoder. JsonToText is the small utility that bridges that gap: it takes that string, parses it, and hands you back the same content as readable text. It's not glamorous, and it's not supposed to be.

    What it is

    JsonToText lives under the pack's Text category and is a display/output node. You drop it after any node that emits structured text - LLavaPromptGenerator, StructuredOutput, Suggester, CreativeArtPromptGenerator - and it renders the JSON as human-readable text so you can see what the model actually decided, or feed that text onward.

    The one input

    • text - a STRING holding JSON, possibly wrapped in code fences, possibly buried inside a larger response. That's the entire input surface. No options to tune, no hidden settings that matter for day-to-day use.

    The output is a single STRING. Since it's an output node, you'll typically wire that string into a text display or use it as the final stop in your prompt-engineering branch.

    How it works

    It parses plain or fenced JSON and renders it as readable text - values pulled out, key/value pairs laid out sensibly, nested JSON pretty-printed so you can actually scan it. If the input isn't valid JSON, it doesn't blow up; it passes the text through so you always get a string back. That "never fail on weird input" behavior is the whole point of a utility like this in a chain where LLM output is never guaranteed to be clean.

    Install

    Same as everything in this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gokayfem/ComfyUI_VLM_nodes
    

    Restart ComfyUI and it's there. ComfyUI Manager users can just search "VLM Nodes." Python 3.9+.

    When you'd skip it

    If you're only using the plain LLaVa samplers or LLMSampler, you don't need this node - those return plain strings already. Reach for JsonToText specifically when something upstream hands you a JSON-looking blob. That's its entire job, and it does it without fuss.

    CategoryVLM Nodes/Text/JSON

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING{}
    format_modeoptCOMBOSmart readable (legacy compatible)5 options: Smart readable (legacy compatible), Pretty JSON, Compact JSON, Values only, Key/value lines
    json_pathoptSTRING
    separatoroptSTRING Used by readable and values-only modes.
    strip_generation_verbsoptBOOLEANtruePreserves the original node's prompt-field behavior.

    Outputs (3)

    NameTypeDescription
    textSTRING
    canonical_jsonSTRING
    itemsINT