JSON Value Mutator
Set one key in a JSON object without rebuilding the whole thing
- Output JSON String
The name overpromises a little - this isn't a general JSON editing toolbox. What it is is the node you want when you've got a JSON object and need to add or overwrite exactly one key without hand-editing a giant string. For a workflow that builds request bodies or patches config on the fly, that single operation is genuinely useful.
How it works
Parse, patch, re-dump. The node takes input_json_string, loads it, and if you've supplied an append_key, sets that key:
input_json[append_key] = json.loads(append_value)
The subtle part is that it tries to parse append_value as JSON first. If the value is valid JSON - a number, a boolean, an array, a nested object - it's stored as that type, not as a string. If it fails to parse, the value is stored as a plain string. So "5" becomes the number 5, "true" becomes a boolean, "[1,2]" becomes an array, and "hello" stays "hello". That's a nice convenience and also the thing to watch: if you wanted the literal string "5", you'd need to quote it ('"5"'). If a key with the same name already exists, it's overwritten - hence "mutator."
Then it re-dumps the whole object with 4-space indent (pretty_enabled, default on) and optional key sorting.
Inputs and outputs
input_json_string- the JSON object to modify, multiline.append_key- the key to add or overwrite.append_value- the value (parsed as JSON when possible).pretty_enabled,sort_enabled- output formatting toggles.
The output is Output JSON String. Invalid input JSON returns {"error": "Invalid JSON: ..."} instead of crashing.
Where it fits
The canonical use is building a request body for the pack's HttpRequestSender: start with a base JSON object, mutate in the one field that changes per run, and wire the result into body_json. It also works for updating a JSON config or inserting metadata before a save. One key per call is the limit - need two fields changed? Chain two of these. It's not a JSON Path editor and it won't reach into nested structures; it's a set-one-top-level-key tool, and it's good at exactly that.
Install
ComfyUI Manager → search "comfy-nekonote-extensions", or:
cd ComfyUI/custom_nodes
git clone https://github.com/0nyx-networks/comfy-nekonote-extensions
Restart ComfyUI; it's under NEKONOTE → Text. Part of the MIT-licensed comfy-nekonote-extensions utility pack by MINETA "m10i" Hiroki (v0.4.7) - zero models, and no dependencies beyond the Python standard library and what ComfyUI already ships. Written against the newer comfy_api.latest backend API, so a current ComfyUI is the one real requirement.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| input_json_string | STRING | — | |
| append_key | STRING | — | |
| append_value | STRING | — | |
| pretty_enabled | BOOLEAN | true | — |
| sort_enabled | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Output JSON String | STRING | — |