Nodes/Comfyui-PixNodes/JSON Mutation (PixNodes)
ComfyUI Node

JSON Mutation (PixNodes)

The JSON editor that edits by path, not by hand

By pixixai·Created 8 months ago·Updated 6 months ago· 24
JSON Mutation (PixNodes)
  • json_data
  • json_data
targetValue
modeReplace
target_paths
new_values

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 - Value or Key. Are you changing the value at a path, or the key itself?
  • mode - Replace, Prepend, or Append.
  • target_paths - one path per line, dot-notation. items.0.name addresses 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 a new_values slot, 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.

CategoryPixNodes/JSON

Inputs (5)

NameTypeDefaultDescription
json_data*
targetCOMBOValue2 options: Value, Key
modeCOMBOReplace3 options: Replace, Prepend, Append
target_pathsSTRING
new_valuesSTRING

Outputs (1)

NameTypeDescription
json_dataJSON