Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!

ComfyUI Node: Prompt JSON

Class Name

ComfyUI_Prompt_JSON

Category
prompt
Author
tkrlab (Account age: 993days)
Extension
ComfyUI_Prompt_List_JSON
Latest Updated
2024-12-23
Github Stars
0.0K

How to Install ComfyUI_Prompt_List_JSON

Install this extension via the ComfyUI Manager by searching for ComfyUI_Prompt_List_JSON
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Prompt_List_JSON in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Prompt JSON Description

Stores positive and negative prompt pairs in JSON lists for retrieval, updates, or random reuse.

Prompt JSON:

ComfyUI_Prompt_JSON helps you organize and reuse pairs of positive and negative prompts across your workflows. It stores named prompts in JSON lists inside the Prompt folder under your ComfyUI base directory. You can create a list, retrieve a saved prompt, update an existing one, or select a saved prompt at random. The node also provides a readable snapshot of the entire list, making it useful when you want to keep related prompt variations together.

Prompt JSON Input Parameters:

Prompt List

Selects the prompt list the node will read and save. The options are New List and the .json files currently found in the Prompt folder under your ComfyUI base directory; the available file options depend on what is in that folder when the node interface is populated. Choose New List to create or use a list named through New List Name. No fixed default, minimum, or maximum is specified in the source.

New List Name

Names the list to use when Prompt List is set to New List. Enter a name without the .json extension: the node appends that extension and uses the resulting filename in the Prompt folder. A blank or whitespace-only name causes an error in this mode. This is a single-line string; no default value or character-length limits are specified.

Random

Controls whether the node selects one saved entry at random from the chosen list. When enabled, the selected entry supplies both returned prompts, and the values entered in Prompt Name, Positive Prompt, and Negative Prompt are not used to create or edit an entry. The list must contain at least one entry. When disabled, the node uses Prompt Name to retrieve, add, or update an entry. This is a Boolean setting; the processing code uses False if no value is supplied, but the interface does not declare a default.

Overwrite

Controls what happens when Random is disabled and Prompt Name already exists in the selected list. When enabled, the node can update that entry using the supplied prompt text. When disabled, it retrieves the saved text instead, without replacing it. This setting does not prevent a new prompt name from being added. It is Boolean; the processing code uses False if no value is supplied, but the interface does not declare a default.

Console Log

Controls whether the node prints the selected prompt name, list name, and positive and negative text to the ComfyUI console during execution. Enable it when you want to check which entry was used, especially with random selection; disable it to avoid that additional console output. It is Boolean; the processing code uses False if no value is supplied, but the interface does not declare a default.

Prompt Name

Identifies an entry within the selected list when Random is disabled. Enter an existing name to retrieve or potentially update that entry, or a new name to add an entry. A blank or whitespace-only value causes an error in manual mode. When Random is enabled, the node chooses a saved name instead. This is a single-line string; surrounding whitespace is removed, and no default value or character-length limits are specified.

Positive Prompt

Provides the positive text when you add a new entry or update an existing one. A new entry requires nonblank positive text. For an existing entry, Overwrite must be enabled for this field to replace saved text; leaving it blank preserves the saved positive text. If Overwrite is disabled, the saved text is returned instead. This is a multiline string; surrounding whitespace is removed, and no default value or character-length limits are specified.

Negative Prompt

Provides the negative text when you add a new entry or update an existing one. It may be blank for a new entry. For an existing entry with Overwrite enabled, nonblank text replaces the saved negative text; a blank field preserves an existing nonblank negative prompt, but remains blank if the saved negative prompt is blank. If Overwrite is disabled, the saved text is returned instead. This is a multiline string; surrounding whitespace is removed, and no default value or character-length limits are specified.

Prompt JSON Output Parameters:

positive

The positive prompt text for the entry the node used. This is a string containing either a randomly selected entry’s saved text, an existing entry’s saved or updated text, or the text supplied for a newly added entry. You can pass it to a later workflow step that accepts a positive prompt string.

negative

The negative prompt text paired with positive. This string comes from the same selected or named entry and reflects any update made during execution. It can be empty if the entry has no negative prompt, so an empty value does not necessarily mean the node failed.

full list

A string containing the entire selected list formatted as JSON, including each prompt name and its positive and negative fields. It reflects the list after any addition or update made during execution. This is a readable text snapshot of the list, not an additional positive or negative prompt.

Prompt JSON Usage Tips:

  • To build a collection, choose New List, enter a New List Name, leave Random off, and supply a unique Prompt Name and a nonblank Positive Prompt. Run the node again with another prompt name to add another entry to the same list.
  • To reuse a saved entry without changing it, select its list, turn Random and Overwrite off, and enter its exact Prompt Name. The node returns the saved positive and negative text even if the prompt text fields contain other text.
  • To revise an entry, select its list, enter its existing Prompt Name, and enable Overwrite. Supply a nonblank Positive Prompt to replace that field; leave it blank to keep the saved positive text. A blank Negative Prompt will not clear a saved nonblank negative prompt.
  • To explore variations, populate a list with several entries, enable Random, and optionally enable Console Log to see the selected entry in the console. Random selection needs a nonempty list.
  • Check full list after adding or editing an entry to confirm what is stored. The node writes the list file on execution, including when it retrieves an entry.

Prompt JSON Common Errors and Solutions:

'New List Name' is required when creating a new list.

  • Explanation: Prompt List is set to New List, but New List Name is empty or contains only spaces.
  • Solution: Enter a list name without the .json extension, or select an existing list from Prompt List.

The selected prompt list is empty or invalid.

  • Explanation: Random is enabled, but the selected list contains no entries, or the loaded JSON has no usable top-level data.
  • Solution: Turn off Random and add an entry with a name and positive prompt, then enable Random again. Alternatively, choose a populated list.

'Prompt Name' is required when Random is not enabled.

  • Explanation: In manual mode, the node needs a name to find, add, or update an entry; the field is blank or contains only spaces.
  • Solution: Enter the name of an existing entry or a name for a new one, or enable Random to choose from a populated list.

'Positive Prompt' is required when adding a new prompt.

  • Explanation: The supplied Prompt Name is not already in the list, and the positive text is empty or contains only spaces.
  • Solution: Enter a positive prompt to create the entry. If you intended to retrieve a saved entry, check its name and selected list.

json.decoder.JSONDecodeError or an error while loading JSON

  • Explanation: The selected .json file cannot be parsed as JSON, so the node cannot read its entries.
  • Solution: Repair the file’s JSON formatting or restore a valid copy, then try again. Back up the file before editing it manually.

TypeError or KeyError when reading a saved entry

  • Explanation: The selected file’s contents do not match the structure the node expects: prompt names should map to entries containing positive and negative fields. A missing field or unexpected value can cause a lookup to fail.
  • Solution: Check the JSON file and correct the affected entries, or recreate the list through the node. Back up the file before making manual changes.

PermissionError or an error creating or saving a file

  • Explanation: The node cannot create the Prompt folder or read or write the selected list file, commonly because of file permissions or a read-only location.
  • Solution: Make sure your ComfyUI installation can write to its Prompt folder and that the selected file is accessible, then run the node again.

Prompt JSON Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_Prompt_List_JSON
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Prompt JSON