π JSON Delete Key
Surgery on a metadata blob, with jq underneath
- Result
Before you re-share a file, remove the embarrassing field
Metadata in a ComfyUI PNG is a JSON document with your entire graph in it - prompts, seeds, model names and hashes, plus whatever paths and filenames your nodes happened to embed. People re-share those files constantly. Sometimes they want to strip something first: an old tag, a custom field with a client name in it, a prompt fragment that no longer applies, a UserComment left over from a JPEG round-trip.
JSON Delete Key removes one key at a given path and hands the JSON back. That's it. The interesting parts are what "path" means and what happens when the JSON is broken.
How it works
It shells out to jq - the same tool you'd use in a terminal - running jq 'del(<your path>)' with your JSON on stdin, and returns jq's stdout. Which means:
- Your Key Path is a jq path expression, not a friendly name.
.metadata.unwanted_tagreaches one level down.["custom"]["UserComment"]works for keys with dots or spaces in them. Anything jq understands, this understands, because it's literally jq. - A bare key gets a dot prepended. Type
promptand the node turns it into.promptfor you - a nice touch, since forgetting the leading dot is the classic first mistake. - Invalid JSON throws. jq exits non-zero and the node raises
jq failed (exit code N)with jq's stderr. Unlikeπ·οΈ Convert Metadata Format, which quietly returns your input on a parse failure, this one stops the run. That's the better behavior for a destructive edit.
Empty input in returns {} out. Deleting a path that doesn't exist is a no-op - jq's del doesn't care.
Inputs and output
JSON Data is a multiline STRING, default {}. Notably it's not socket-only, so unlike the array nodes you can paste a blob straight in while you're experimenting. In a real workflow it comes from π·οΈ Extract Metadata via a text pass-through, or from π JSON Merge / π JSON Set Key.
Key Path - a STRING, default .key_to_delete (which is a placeholder, not a real path; delete nothing with it and you'll get your JSON back unchanged). This is the field to get right, and the cheapest way to check it is to paste the JSON into a terminal and run jq by hand:
echo '{"a":1,"b":{"c":2}}' | jq 'del(.b.c)'
If that does what you want, your path is right and the node will behave identically.
One output: Result (STRING), the modified JSON. Wire it into π JSON Preview to eyeball it, π·οΈ Convert Metadata Format if you're about to save in a different container, or the pack's metadata writer.
What this is actually for
The scenario that makes sense of the node: you've extracted metadata from an image, you want to keep the prompt but not the workflow chunk (the full node graph, which is the part that leaks your pipeline), and you want to save a fresh copy. Extract β Delete Key with .workflow β write. Two nodes and a jq path, and the resulting file has the generation parameters without the graph.
The counter-argument, and it's a fair one: if you're stripping metadata to post something, you could also just export to JPEG and lose everything by accident. Which works, but loses everything, including the fields that were fine to share. Delete Key is for the surgical version - remove this one thing, keep the rest.
Install
Manager: Extensions β Node Pack β search "Honda Nodes" β Install β restart. If you installed by hand, this node needs the installer step, or it will fail with "The 'jq' CLI tool was not found":
cd ComfyUI/custom_nodes
git clone --depth 1 https://github.com/Avaray/honda-nodes.git
cd honda-nodes
python install.py # ComfyUI's python; portable Windows: ..\..\..\python_embeded\python.exe install.py
install.py fetches a jq binary appropriate for your platform into honda-nodes/bin. If you already have jq on your PATH, the node will use that instead - the lookup checks PATH first. ComfyUI 0.38.0+ required; the pack is V3-schema only.
Common issues
"jq failed (exit code 4)". Syntax error in the key path. A missing closing bracket, a typo'd dot, or a del(.foo that never closes. jq's stderr is printed in the error message - read it, it points at the character.
"jq failed" with a parse error about invalid JSON. Your JSON Data isn't JSON. Very common cause: Windows paths inside the JSON with single backslashes, because "C:\Users\run1" contains \U and isn't a valid escape. Either double them (\\) or don't put raw paths in metadata. Pipe the string through π JSON Validate first if you're not sure.
Nothing was deleted. The path didn't match anything - jq's del silently ignores non-existent paths. Check the shape of your JSON with π JSON Preview; the key you want may be nested one level deeper than you assumed, or live under custom.PngText rather than at the top.
You deleted too much. There's no undo. Keep the extracted original in a text node or on disk before you start editing - this is the same advice as everywhere else in ComfyUI's metadata layer, and it's cheaper than re-deriving a graph you stripped.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_data | STRING | {} | The JSON string to modify. |
| key_path | STRING | .key_to_delete | The jq path for the key to remove, e.g., '.metadata.unwanted_tag'. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Result | STRING | β |