ComfyUI Node

VRGDG_Json2String

Turning a JSON blob into something an LLM can actually read

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG_Json2String
  • json_input
  • text_output
prettytrue

Every structured thing in this pack eventually wants to become prose. VRGDG_Json2String is the node that makes that happen: it takes a JSON value and serializes it into a plain text string you can feed to a prompt, an LLM, or a text display. It exists because the audio-splitter nodes in this pack hand you a meta dict full of scene numbers, timings, and durations - useful data, but useless to a language model until it's text.

What it does

  • json_input (JSON) - the structured data. Wire the meta output of any VRGDG_LoadAudioSplit_* node in here, or the json_output of VRGDG_LyricSegmentJsonFixer.
  • pretty (BOOLEAN, default true) - whether to format the output with indentation. Leave it on while you're debugging; it turns an unreadable blob into something you can scan at a glance. Flip it off if you're feeding the result into something that expects compact JSON (or if you're counting tokens and want the whitespace gone).
  • text_output (STRING) - the serialized JSON.

Under the hood it's a json.dumps() with an indent flag, which tells you everything about how much magic to expect. The value of the node isn't the logic - it's that ComfyUI won't let you drag a JSON/DICT wire into a STRING port, so this is the sanctioned bridge.

Why this pattern matters here

This pack's workflow is a pipeline of conversions: audio gets split into scenes, the scene metadata becomes text, the text gets handed to an LLM (VRGDG_LLM_Multi) that writes scene prompts, and those prompts drive LTX video generation. Each hop is a type conversion, and Json2String is the hop that makes a machine-readable dict legible to a model that only thinks in tokens.

One tip from the trenches: keep pretty on while you're building the workflow and use a ShowText-style node to inspect what the splitter actually produced. The meta output of the split nodes is where scene counts, per-scene durations, and offsets all live - eyeball the formatted string once and you'll understand the whole pipeline's data flow without digging through logs.

Installing it

No separate install - it's part of the comfyui-vrgamedevgirl pack. ComfyUI Manager: search "vrgamedev", install, restart. Or:

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

Then install the requirements into your ComfyUI Python environment:

pip install -r custom_nodes/comfyui-vrgamedevgirl/requirements.txt

The README lists just three deps - kornia, librosa, imageio - none of which this node itself needs. It's a pure stdlib conversion; you get it for free as part of the pack.

If it's not working

The one thing that bites: passing in something that isn't valid JSON. The meta outputs from the splitter nodes are proper dicts, but if you're feeding it from a node that hands you a string that looks like JSON, Json2String won't parse it - it expects an actual structured value, not a text representation. That's exactly the job VRGDG_LyricSegmentJsonFixer handles on the text side of the pipeline, so if you're staring at raw JSON text that needs cleaning, that's the node you want instead.

CategoryVRGDG/General

Inputs (2)

NameTypeDefaultDescription
json_inputJSON
prettyBOOLEANtrue

Outputs (1)

NameTypeDescription
text_outputSTRING