Nodes/Octo Json Presets/Save Experiment Presets to Json
ComfyUI Node

Save Experiment Presets to Json

The write half of ComfyUI's experiment loop — save your settings to JSON

By writer-in-fancy-pants·Created 12 months ago·Updated 12 months ago· 0
Save Experiment Presets to Json
      json_filedefault.json
      seed-1
      steps-1
      cfg-1.00
      width-1
      height-1
      positive_prompt
      negative_prompt
      sampler
      scheduler
      filename_prefix

      You found a seed, a CFG, and a resolution that you want to compare against three others. Do you screenshot the settings and retype them later? "Save Experiment Presets to Json" exists so you don't have to: it takes whatever settings you've dialed in, appends them as one entry to a JSON file, and that file is exactly what its sibling - Load Experiment Presets from Json - will step through later. Save now, Load later, one workflow runs the whole grid. It's the write half of a genuinely tidy loop.

      How it works

      Every input on this node is optional, and the defaults are the secret: the numeric fields default to -1 and the strings default to empty, and the node treats those as "don't record this". Anything you set above the default gets written; anything left alone gets skipped. So it's not a form you must fill completely - it's a delta recorder. Set just steps and cfg, run it, and you've saved a two-field experiment entry.

      The full set of inputs: json_file, seed, steps, cfg, width, height, positive_prompt, negative_prompt, sampler, scheduler, and filename_prefix. The node validates as it goes - samplers and schedulers are only recorded if they're real ComfyUI names, which is a nice touch that stops a typo from corrupting a batch.

      On run, it appends one object to the JSON array at presets/<json_file> (the pack's presets folder inside custom_nodes) and writes it back with pretty indentation. If the file doesn't exist yet, it creates it from scratch - which is why the default json_file is default.json, not a required existing file. It outputs nothing; it's purely a side effect, so you'll want to trigger it deliberately and then feed the same filename into the Load node.

      Where the filename prefix matters: if you're building a comparison batch, setting a descriptive filename_prefix per experiment means the Load node's auto-built filenames (and your saved images) tell you at a glance what each run actually was.

      The catch: same bug as its sibling

      Be aware this is a young, single-commit pack, and the Save method has the same flaw as Load: the function signature is missing self, which makes ComfyUI's call fail with TypeError: got multiple values for argument 'json_file' on execution. It's a two-second patch in src/octo_json_presets/nodes.py if you're comfortable editing Python, but expect a crash out of the box. If you hit it, it's not your JSON - it's the node.

      Two real gotchas, even after the fix

      • Files live inside the pack's directory. presets/ sits under ComfyUI/custom_nodes/octo_json_presets/. If ComfyUI Manager later runs an update (a git pull), a filename collision can clobber your saved experiments. Keep the batch files you care about backed up outside the pack.
      • It's append-only by design. Save never edits an existing entry; every run adds a new object. Accidentally queue a save twice and you've got a duplicate experiment in the file. The Load node doesn't care - it just steps through - but your grid just quietly got longer.

      Installing it

      ComfyUI Manager: search Octo Json Presets and install, then restart. Or clone it manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/writer-in-fancy-pants/octo_json_presets
      

      No extra dependencies and no models to download - it only writes a small JSON file. Look for it under octo_presets in the node menu. Pair it with the Load node, keep backups of your presets/ folder, and you've got a decent little experiment runner for free.

      Categoryocto_presets

      Inputs (11)

      NameTypeDefaultDescription
      json_fileSTRINGdefault.json
      seedoptINT-1
      stepsoptINT-1
      cfgoptFLOAT-1.00
      widthoptINT-1
      heightoptINT-1
      positive_promptoptSTRING
      negative_promptoptSTRING
      sampleroptSTRING
      scheduleroptSTRING
      filename_prefixoptSTRING

      Outputs (0)

      No outputs