ComfyUI > Nodes > ComfyUI-LLMs-Toolkit > String Template

ComfyUI Node: String Template

Class Name

StringTemplate

Category
🚦ComfyUI_LLMs_Toolkit/JSON
Author
HuangYuChuh (Account age: 42days)
Extension
ComfyUI-LLMs-Toolkit
Latest Updated
2026-04-23
Github Stars
0.02K

How to Install ComfyUI-LLMs-Toolkit

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

String Template Description

Dynamic text generation by replacing placeholders with JSON values for personalized, context-aware outputs.

String Template:

The StringTemplate node is designed to facilitate the dynamic generation of text by replacing placeholders within a template string with corresponding values from a JSON-formatted context. This node is particularly useful for AI artists who need to create personalized or context-aware text outputs without manually editing each instance. By leveraging JSON data, you can automate the process of text customization, ensuring consistency and efficiency in your creative workflows. The node's primary function is to parse the input JSON to extract variable values and seamlessly integrate them into the specified template, allowing for flexible and powerful text manipulation.

String Template Input Parameters:

template

The template parameter is a string input where you define the text containing placeholders for variables. These placeholders are denoted by curly braces, such as {name}. This parameter allows you to specify the structure and content of the text you wish to generate, with the placeholders acting as dynamic elements that will be replaced by actual values from the JSON context. The default value is an empty string, and it supports multiline input, enabling you to create complex text structures. This parameter does not have a minimum or maximum value but serves as the foundation for the text rendering process.

variables

The variables parameter is a JSON string that contains the key-value pairs used to replace the placeholders in the template. This JSON object acts as the context for the template rendering, where each key corresponds to a placeholder in the template, and the associated value is what will replace the placeholder. The default value is an empty JSON object ({}), and it is crucial to ensure that the JSON is correctly formatted to avoid errors. This parameter allows you to dynamically inject data into your template, making it adaptable to various contexts and scenarios.

String Template Output Parameters:

string

The string output parameter is the final formatted string resulting from the template rendering process. It represents the template with all placeholders replaced by their corresponding values from the JSON context. If a placeholder does not have a corresponding value in the JSON, it remains unchanged in the output. This output is crucial for generating customized text outputs that reflect the input data, providing a seamless way to create personalized content.

String Template Usage Tips:

  • Ensure that your JSON string in the variables parameter is correctly formatted to avoid parsing errors. Use a JSON validator if necessary.
  • Use descriptive and unique keys in your template placeholders to avoid conflicts and ensure clarity in your text outputs.
  • Test your template with different JSON inputs to verify that all placeholders are correctly replaced and that the output meets your expectations.

String Template Common Errors and Solutions:

Failed to parse variables JSON

  • Explanation: This error occurs when the variables input is not a valid JSON string, preventing the node from parsing it correctly.
  • Solution: Double-check the JSON format for syntax errors, such as missing commas or mismatched brackets. Use a JSON validator to ensure correctness.

Variables input is not a JSON object

  • Explanation: This warning indicates that the parsed variables input is not a JSON object, which is required for the node to function properly.
  • Solution: Ensure that the variables input is a JSON object, with key-value pairs enclosed in curly braces. Avoid using arrays or other data types.

String Template Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-LLMs-Toolkit
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.

String Template