StepFun JSON Parser
Splits a JSON string into separate outputs — but only after you run it once
StepFun JSON Parser is the pack's answer to a very specific annoyance: the chat nodes can return JSON, but ComfyUI wants separate values, not one blob of braces. This node takes a JSON string, and if it's an object, pops each key out as its own string output. It's the natural partner to the json_mode toggle on StepFun Chat Completion and StepFun Video Chat - ask the model for structured JSON, then split it into fields you can wire into different parts of the graph.
There's a catch you need to know before you start wiring things up: this node's outputs are dynamic. It has no fixed output list. The sockets appear based on whatever keys are in the JSON you feed it, and they're generated at runtime when the node executes. That's why the node's schema shows no outputs at all - they don't exist until it runs.
How it works
The node parses the input with json.loads, then insists the result is a dict. Each key becomes an output, and each value is converted to a string - dicts and lists get re-serialized as compact JSON, everything else becomes its string form. If the JSON is invalid, or it parses to a list instead of an object, the node raises an error and tells you parsing failed.
That dynamic-output trick is neat and also mildly cursed. Because ComfyUI's graph editor doesn't know the sockets until execution, you'll typically have to run the node once (or watch it run as part of the queue) before you can connect its outputs. Run, then connect, then re-run - that's the rhythm.
Inputs and outputs
- json_string - a single required multiline string containing the JSON object.
Outputs: one per top-level key, each a STRING, named after the key. Feed it {"caption": "a dog", "style": "anime"} and you get caption and style sockets. Nested objects come out as their own JSON strings, not flattened - you can chain a second parser if you want to dig deeper, though that gets fiddly fast.
Installing
Same pack, same install as the rest:
cd ComfyUI/custom_nodes
git clone https://github.com/chenbaiyujason/ComfyUI_StepFun
cd ComfyUI_StepFun
pip install -r requirements.txt
Or search "ComfyUI-SCStepFun" in ComfyUI Manager, restart, and find it under the StepFun category. No API key needed - it's pure local string handling.
Troubleshooting
- "JSON must be an object" - you fed it a JSON array or a scalar. Wrap it in braces.
- Red node with a parse error - malformed JSON (missing comma, trailing comma, unquoted key). It's strict, so copy-paste JSON from a model output that has markdown fences around it (
```json) and the fences themselves will break it - strip them first. - No sockets to connect - expected. Run once to materialize the outputs, then connect.
It's a small, oddly-named utility, and the dynamic outputs will surprise you the first time. But if you're already leaning on json_mode in this pack, it's the difference between parsing JSON with your eyeballs and actually using the structured result in your workflow.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| json_string | STRING | — |
Outputs (0)
No outputs