Remove JSON Markdown
Strip the code fence an LLM won't stop adding
- STRING
Ask an LLM API to "return only JSON" and a good chunk of the time you still get it wrapped in a ```json ... ``` markdown code fence anyway, because that's just how chat models are trained to format code - it looks right to a human reading it in a chat window and breaks anything downstream that expects a clean string. If the next node in your graph is trying to parse that text as JSON, the stray backticks are enough to make it choke. Remove JSON Markdown exists to strip exactly that wrapper before it causes a problem.
Why this shows up in a ComfyUI pack at all
LLM calls are increasingly just another node in the graph, not something you only do outside ComfyUI. Prompt-enhancer nodes that call ChatGPT or a local Ollama model to expand or rewrite a prompt before it hits the sampler show up in more than one video-model ecosystem already - LTX-Video workflows have used a ChatGPT node for prompt enhancement, and Wan-Video workflows include community tooling that bundles an Ollama-based enhancer. Any of those that ask the model for structured output - a list of shot descriptions, a JSON blob of camera moves, a tag set - run into the same fencing problem, and that's the gap this node quietly fills.
How it works
It takes the raw text, strips the leading and trailing code fence (```json or a plain ```) along with any surrounding whitespace, and returns clean text you can hand straight to an actual JSON-parsing node without it tripping over stray backticks.
The inputs and outputs that matter
- text - a multiline STRING. The raw LLM output, fence and all.
- Output: a single STRING - the same text with the markdown fence stripped.
That's the entire interface. It's a small, single-purpose glue node, and that's the point - it does one annoying, specific thing so you don't have to write a regex for it inside a more complicated node.
How to install it
One of six nodes in ComfyUI UX Nodes, from Reddit's Anibaaal - better known there for a popular Flux realism LoRA than for node development, which fits this pack's overall shape: small, practical fixes for things that were annoying enough to bother writing. The README is a bare list of node names, no install or dependency section, so use the standard route: ComfyUI Manager, search ComfyUI UX Nodes, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Anibaaal/ComfyUI-UX-Nodes
then restart ComfyUI. Plain string handling - no models, no unusual dependencies.
Common issues & troubleshooting
Downstream JSON parsing still fails after this node. This node strips markdown fencing - it doesn't validate or repair the JSON itself. If the LLM produced malformed JSON underneath the fence (a trailing comma, an unescaped quote), this node passes clean-but-still-broken text straight through, and the failure just shows up one node later at the actual parser. Check the raw text for structural JSON errors separately if stripping the fence didn't fix it.
Nothing visibly changes for some LLM outputs. Not every model wraps its output in a code fence every time - it's inconsistent per model and sometimes per call. If there was no fence to begin with, this node is a no-op and passes the text through unchanged, which is the expected, harmless case, not a sign it's broken.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |