Nodes/comfyui-art-venture/Get Text From JSON
ComfyUI Node Runs on cloud

Get Text From JSON

Pull one string out of a JSON blob

By sipherxyz·Created 3 years ago·Updated 4 months ago· 352
Get Text From JSON
  • json
  • STRING
key

You've got a chunk of JSON floating through your workflow - maybe from an API, maybe from an LLM node, maybe loaded off a URL - and you need one string out of it to use as a prompt. That's this node's entire job. Point it at a JSON value, give it a key, get the text back. It's plumbing, but the kind of plumbing that turns a rigid graph into something you can drive from outside.

Where it shows up: any time your ComfyUI workflow is being fed by something else. A caption model returns {"caption": "a cat on a sofa"} and you want the caption. An API hands back a settings object and you want the prompt field. You loaded a JSON config from a URL and need one value out of it. Rather than hard-coding text into the graph, you let the data decide. That's the whole appeal of the ArtVenture JSON nodes - they make a workflow parameterizable.

How it works

It takes a parsed JSON value and walks a path into it using a key you provide, then returns whatever's at that path as a string. The pack uses a dotted path syntax that handles nesting and arrays: key.[index].subkey.[sub_index]. So messages.[0].content reaches into the first element of a messages array and grabs its content. If the value it lands on isn't already a string, it gets coerced into one on the way out.

Inputs and outputs

Two inputs, both required:

  • json - the JSON value to read from. This is wired in from another node (LoadJsonFromUrl, an LLM node, GetObjectFromJson drilling into a bigger object), not typed by hand.
  • key - the path to the value you want, as a string. Top-level is just caption; nested uses the dotted a.b.[0].c form. Leave it empty and you get nothing useful, so this is the field you actually think about.

The output is a single STRING - ready to drop straight into a CLIP Text Encode, a filename, a switch node, wherever a string goes.

Installing it

Comes with the ArtVenture pack. Via ComfyUI Manager: search comfyui-art-venture, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/sipherxyz/comfyui-art-venture

Restart ComfyUI afterwards. There are no model downloads for the JSON nodes - they're pure Python, lightweight, and load instantly.

Common issues

Empty or wrong output. Almost always a key that doesn't match the JSON's actual shape. The fix is to look at the data first: load your JSON with print_to_console turned on in LoadJsonFromUrl (or eyeball the API response) and copy the real path. Case matters, and array indices need the bracket form [0].

"It returned a number/object, not the text I wanted." For a nested object you probably want GetObjectFromJson to drill down first, then GetTextFromJson on the leaf. Mixing the two lets you navigate deep structures a step at a time instead of writing one monster key.

Nothing's flowing through. Confirm the upstream node is actually emitting JSON, not a raw string. If you have JSON text, it needs to be parsed into a JSON value first - the URL/text loader nodes do that. GetTextFromJson expects an already-parsed value on its json input.

CategoryArtVenture/Utils

Inputs (2)

NameTypeDefaultDescription
jsonJSON
keySTRING

Outputs (1)

NameTypeDescription
STRINGSTRING