Nodes/Comflowy's Custom Nodes/Comflowy Extract JSON
ComfyUI Node

Comflowy Extract JSON

Pull the one value you need out of a response blob

By 6174·Created 2 years ago·Updated 2 years ago· 17
Comflowy Extract JSON
  • json_value
  • text1
  • text2
  • text3
  • text4
  • text5
json_path1
json_path2
json_path3
json_path4
json_path5

APIs don't hand you what you need; they hand you a JSON blob and make you dig. Comflowy Extract JSON is the digging tool. You feed it a JSON value plus up to five dot-separated paths, and it pulls the value at each path out as a string. This is the node that closes the loop in any workflow where structured data meets text: HTTP request returns a response → extract the one field → feed it into a prompt, a filename, or another node.

The pack's data story only makes sense with this node in it. Comflowy Http Request brings JSON in, Comflowy Preview JSON lets you see it, and this node turns it into something usable. Without it, an API response is a dead end - with it, you can do things like pull a job ID out of a POST response and feed it to the next request in the chain. It's the difference between "my workflow can talk to an API" and "my workflow can use what the API said."

How it works and the inputs

The node walks the JSON using the dot-separated path as a key sequence. a.b.c digs into nested objects; an array index works too - the node description's own example is outputs.0.text for "the first item's text field." Paths that resolve to a string come back as-is; anything else (objects, lists, numbers) gets json.dumps'd so you still get something usable.

  • json_value (required) - the JSON object to dig into.
  • json_path1 through json_path5 (optional) - up to five independent paths. Leave one blank and its output stays empty.

Outputs: text1 through text5 - one STRING per path, in order. The node is an output node, so it also shows a combined preview of all five.

Installing and the gotchas

Install Comflowy's Custom Nodes via ComfyUI Manager (search "Comflowy") or git clone https://github.com/6174/comflowy-nodes into custom_nodes, restart. No API key; it's a local, pure-Python node.

The two things that trip people up:

  • Missing paths return an error string, not empty. The node description is explicit: if the path isn't found, you get an error message string ("Extract error: ...") in the output. If your downstream node suddenly has text that looks like a Python traceback, you've got a wrong path - and the error string is the tell.
  • get_nested_value returns the first missing key's default and stops. If a exists but a.b doesn't, you get the error path, not a graceful fallback. Confirm your path against Comflowy Preview JSON first.
  • Arrays need indexes, not names. If the value is a list, outputs.text won't work - you need outputs.0.text. The example in the node description is the pattern to copy.

One more habit worth building: keep Comflowy Preview JSON upstream of this node while you're debugging. See the structure, then write the path that matches reality.

CategoryComflowy

Inputs (6)

NameTypeDefaultDescription
json_valueJSON
json_path1optSTRING
json_path2optSTRING
json_path3optSTRING
json_path4optSTRING
json_path5optSTRING

Outputs (5)

NameTypeDescription
text1STRING
text2STRING
text3STRING
text4STRING
text5STRING