ComfyUI Node: JSON

Class Name

JSONNode

Category
COCO Tools/JSON Tools
Author
Conor-Collins (Account age: 431days)
Extension
ComfyUI-CoCoTools
Latest Updated
2025-03-05
Github Stars
0.03K

How to Install ComfyUI-CoCoTools

Install this extension via the ComfyUI Manager by searching for ComfyUI-CoCoTools
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-CoCoTools 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

JSON Description

Versatile tool for handling JSON data within COCO Tools, facilitating reading and writing of JSON files for AI artists.

JSON:

The JSONNode is a versatile tool designed to handle JSON data within the COCO Tools framework. Its primary purpose is to facilitate the reading and writing of JSON files, which are commonly used for storing structured data. This node is particularly beneficial for AI artists who need to manage metadata associated with their projects, such as prompts and seeds used in generative art processes. By providing a straightforward interface for accessing and manipulating JSON data, the JSONNode simplifies the workflow, allowing you to focus on the creative aspects of your work. Whether you need to extract specific information from a JSON file or export data into a structured format, this node offers the necessary functionality to streamline these tasks.

JSON Input Parameters:

folder_path

The folder_path parameter specifies the directory where the JSON file is located. It is crucial for locating the file that contains the metadata you wish to read or write. The default value is set to "D:/Default_Folder/", but you can change it to any valid directory path on your system. This parameter ensures that the node knows where to look for the JSON file, and it must be a valid directory path for the node to function correctly.

name

The name parameter represents the base name of the JSON file you want to interact with. By default, it is set to "metadata", but you can customize it to match the specific file you are working with. This parameter is used to construct the full path to the JSON file by appending ".json" to the name and combining it with the folder_path. It is essential for identifying the correct file within the specified directory.

JSON Output Parameters:

Seed

The Seed output parameter provides the seed value extracted from the JSON file. This value is often used in generative art to ensure reproducibility of results. It is an integer that can influence the randomness of the generated artwork, allowing you to recreate the same piece by using the same seed.

Positive Prompt

The Positive Prompt output parameter contains the positive prompt extracted from the JSON file. This string is typically used to guide the AI in generating desired features or elements in the artwork. It plays a crucial role in shaping the final output by providing specific instructions or themes for the AI to follow.

Negative Prompt

The Negative Prompt output parameter holds the negative prompt extracted from the JSON file. Similar to the positive prompt, this string is used to instruct the AI on what to avoid or minimize in the generated artwork. It helps refine the output by specifying undesired elements or characteristics, ensuring the final piece aligns with your artistic vision.

JSON Usage Tips:

  • Ensure that the folder_path is correctly set to the directory containing your JSON files to avoid file not found errors.
  • Customize the name parameter to match the specific JSON file you are working with, especially if you have multiple files in the same directory.
  • Use the Seed output to recreate specific generative art pieces by reusing the same seed value in your projects.

JSON Common Errors and Solutions:

"The provided directory path '<json_directory>' is not valid."

  • Explanation: This error occurs when the specified folder_path does not exist or is not a directory.
  • Solution: Verify that the folder_path is correct and points to an existing directory on your system.

"Expected exactly one JSON file in directory '<json_directory>', found <number>."

  • Explanation: This error indicates that there is either no JSON file or multiple JSON files in the specified directory, while the node expects exactly one.
  • Solution: Ensure that there is only one JSON file in the directory or adjust the directory contents accordingly.

"Invalid JSON format in file '<json_file_path>'."

  • Explanation: This error suggests that the JSON file is not properly formatted and cannot be parsed.
  • Solution: Check the JSON file for syntax errors and correct any issues to ensure it is valid JSON.

"Key '<key_to_find>' not found in available keys: <list_of_keys>."

  • Explanation: This error occurs when the specified key is not present in the JSON data.
  • Solution: Verify that the key you are trying to access exists in the JSON file and is correctly spelled.

JSON Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-CoCoTools
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 Playground, enabling artists to harness the latest AI tools to create incredible art.