ComfyUI > Nodes > Basic data handling > format_map

ComfyUI Node: format_map

Class Name

Basic data handling: StringFormatMap

Category
Basic/STRING
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

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

format_map Description

StringFormatMap node dynamically constructs strings by replacing placeholders with dictionary values.

format_map:

The StringFormatMap node is designed to facilitate the dynamic construction of strings by replacing placeholders within a template string with corresponding values from a dictionary. This node leverages the format_map() method, which allows you to define a string with placeholders, such as "Hello, {name}", and then populate these placeholders with actual values provided in a dictionary, like {"name": "World"}. This functionality is particularly useful for generating personalized messages or constructing strings where the content needs to be dynamically adjusted based on varying input data. By using this node, you can efficiently manage and format strings without manually concatenating or inserting values, thus streamlining the process of string manipulation in your projects.

format_map Input Parameters:

template

The template parameter is a string that contains placeholders enclosed in curly braces, such as {key}. These placeholders are intended to be replaced by corresponding values from the mapping dictionary. The default value for this parameter is "Hello, {key}". The template string serves as the blueprint for the final output, and its structure directly influences the resulting formatted string. By defining the placeholders within the template, you can control which parts of the string will be dynamically replaced with values from the mapping.

mapping

The mapping parameter is a dictionary that maps keys to values, which are used to replace the placeholders in the template string. The default value for this parameter is an empty dictionary {}. Each key in the dictionary should correspond to a placeholder in the template. When the node executes, it searches for each placeholder in the template and replaces it with the associated value from the mapping. This parameter is crucial for providing the actual data that will populate the template, enabling the creation of customized and contextually relevant strings.

format_map Output Parameters:

IO.STRING

The output of the StringFormatMap node is a single string, which is the result of replacing the placeholders in the template with the corresponding values from the mapping. This output string reflects the final formatted version of the template, with all specified placeholders substituted by their respective values. The output is crucial for applications where dynamically generated text is required, such as personalized messages or reports, ensuring that the final string accurately represents the intended content with all necessary data inserted.

format_map Usage Tips:

  • Ensure that all placeholders in the template have corresponding keys in the mapping dictionary to avoid key errors and ensure a smooth formatting process.
  • Use descriptive and unique keys in your template to avoid conflicts and make it easier to manage and understand the mapping of values.

format_map Common Errors and Solutions:

Key error: <key> not found in mapping

  • Explanation: This error occurs when a placeholder in the template does not have a corresponding key in the mapping dictionary.
  • Solution: Verify that all placeholders in the template have matching keys in the mapping dictionary and that there are no typos in the keys.

Formatting error: <error_message>

  • Explanation: This error indicates a general issue with the formatting process, which could be due to incorrect data types or other unexpected conditions.
  • Solution: Check the template and mapping for any inconsistencies or unsupported data types, and ensure that the template is correctly structured with valid placeholders.

format_map Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
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.

format_map