ComfyUI Node

VRGDG_String2Json

Turn an LLM's text into something your graph can parse

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG_String2Json
    • json_output
    text
    auto_fixtrue

    VRGDG_String2Json is the straight-down-the-middle version of JSON parsing for a ComfyUI graph: text goes in, a json_output comes out. Two inputs - text (multiline) and auto_fix (a boolean, default true) - one output. It's the lightweight sibling of VRGDG_StoryGroupJsonFixer: same idea, less ceremony, no "was it fixed" bookkeeping. If you just need a parsed JSON object and you don't care about the forensic detail, this is the one.

    When you'd reach for it

    This pack's workflows generate structured data with LLMs all over the place - scene lists, storyboard entries, prompt overrides - and LLMs emit strings, not objects. ComfyUI's JSON type is a real wire type, but nothing in core turns a raw model output into one. This node is that missing cast: string → JSON, ready to feed a node that expects structured input. With auto_fix on (the default), it'll also take a swing at the usual LLM sloppiness - fences, trailing commas - before giving up and failing cleanly.

    The honest comparison

    The pack gives you two JSON nodes, and the choice is simpler than it looks:

    • VRGDG_String2Json - parse and move on. Use it when your LLM is behaving, the text is near-clean, and you want minimal clutter. The json_output is the whole story.
    • VRGDG_StoryGroupJsonFixer - parse with a safety report. Use it when the output has to be trusted before it drives a render - you get was_fixed and notes telling you whether the parse was clean or the result of surgery.

    If your pipeline is still being built and you're not sure which you need, start with String2Json and add the fixer when broken output actually bites you. Most LLM outputs these days are clean-ish if you prompt for strict JSON, and String2Json plus a well-written prompt will carry you a long way.

    Install

    Same pack, same drill:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl
    

    or ComfyUI Manager → "vrgamedev", restart. Requirements kornia, librosa, imageio install with it.

    The realistic warning: auto_fix will paper over a lot, but there's a line between "repair" and "interpretation," and when parsing crosses it you get confident garbage - valid JSON, wrong meaning. For anything that's going to run unattended for hours (which is this pack's whole lifestyle), it's worth one ShowText tap on the output to see what you're actually feeding downstream. Cheap insurance, one node, five seconds.

    CategoryVRGDG/General

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    auto_fixBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    json_outputJSON