JSON Mutation (PixNodes)
The JSON editor that edits by path, not by hand
- json_data
- json_data
Most JSON nodes build or split. JSON Mutation is the one that edits - it walks into a nested structure along dot-notation paths and rewrites keys or values in bulk. This is the node you reach for when an LLM hands you a JSON blob with a field named "prompt_1" and you need it renamed to "prompt", or when a nested list needs a value appended to every entry.
The schema reads like a tiny scripting language, and that's basically what it is:
target-ValueorKey. Are you changing the value at a path, or the key itself?mode-Replace,Prepend, orAppend.target_paths- one path per line, dot-notation.items.0.nameaddresses the first item's name;*is a wildcard that hits every entry in a list or every value in a dict.new_values- one value per line, paired with the paths by order.
So target_paths of shots.*.prompt with new_values of a cinematic closeup replaces the prompt field on every shot in one run. That wildcard-plus-path combination is the node's superpower and also the thing to be careful with.
The power moves
Two features lift this above a plain find-replace:
- Broadcast. Prefix a single new value with
@(like@1.0) and it applies to every path line, instead of needing one value per line. - Delete. Prefix a path with
-(like-items.0) and that entry gets removed rather than edited. Delete paths don't consume anew_valuesslot, so you can mix edits and deletions in one pass.
There's a light type-sniffing layer too: values that parse as JSON numbers/booleans/lists are stored as those types, not as strings, so @5 sets a real integer, not "5".
The inputs
json_data (wildcard) is the structure to edit; the four config fields above do the rest. Output is json_data (JSON) - the mutated copy. It operates on a deep copy, so the original isn't clobbered.
Install
Part of Comfyui-PixNodes. ComfyUI Manager → search "PixNodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes
then restart. (The README's manual-install block points at the wrong repo, ComfyUI-AlignLayout - use the URL above.)
Where it gets dangerous
Path typos are silent. The node swallows "path doesn't exist" errors, so a misspelled path does nothing and you'll never be told - always check the output. And the wildcard means one mistake propagates to every entry, which is exactly what you wanted, until it isn't. For a beginner this is the node to start with on a small test object, not the one to point at your one-shot production payload blind. Used deliberately, it turns "edit this JSON from the LLM" into a two-minute job instead of a copy-paste slog.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| json_data | * | — | |
| target | COMBO | Value | 2 options: Value, Key |
| mode | COMBO | Replace | 3 options: Replace, Prepend, Append |
| target_paths | STRING | — | |
| new_values | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_data | JSON | — |