MetaData Convert to EXTRA_METADATA
The metadata-to-dictionary node whose name is a little bit of a lie
- EXTRA_METADATA
Let's get the naming out of the way, because it will trip you up: MetaData Convert to EXTRA_METADATA (class MarMetaDataToJSON) doesn't output a JSON string at all. Despite the name, it returns a plain Python dictionary, typed EXTRA_METADATA on the output socket. That's not a bug - it's the point. The dictionary is what a modern ComfyUI SaveImage node accepts on its optional EXTRA_METADATA input, which is how custom key/value pairs get written into the PNG itself alongside the workflow and prompt text chunks.
In other words: this is the node that takes a human-readable metadata string and turns it into something the file-saver can embed. If you've ever dragged a generated image back into ComfyUI and wondered why your custom tags didn't come with it, this is the missing link.
How it works
The input format is the same dialect the whole MDSNodes metadata family speaks: Key1 [Value1]; Key2 [Value2]; Key3 [Value3];... - the exact string MetaData Append builds. The node splits on semicolons, then runs each pair through a regex (^(.*?)\s*\[(.*?)\]$) to pull the key and the bracketed value apart, and stuffs the results into a dictionary.
A few mechanical facts worth knowing:
- Every value comes out as a string.
steps [28]becomes"28", because everything inside the brackets is captured as text. If your downstream consumer needs a number, convert it first. - Duplicate keys are overwritten, last one wins. The string is a pile of labels, not a hierarchy.
- An empty metadata input returns an empty dictionary,
{}, rather than erroring out. Friendly, but it means a blank wire silently produces no metadata rather than telling you something's wrong.
The input and the output
One input, one output. The metadata input is forceInput - wire it from a MetaData Append node or wherever the string lives; you don't type into it. The EXTRA_METADATA output is a dictionary you plug straight into the matching input on core SaveImage (present in recent ComfyUI versions). Wire the two and every key/value you appended upstream lands in the saved PNG's text chunks, readable by whatever tooling cares - drag it back in, or let CivitAI's uploader pick up the custom fields.
Installing it
Same story as the rest of the pack - no dependencies, no models, nothing to babysit:
# ComfyUI Manager: search "ComfyUI-MDSNodes" and Install
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
Restart ComfyUI and the node appears under MDSNodes/text.
Where people get burned
The first trap is format drift. The parser is strict about the Key [Value] structure - a key without brackets, or values separated by commas instead of semicolons, quietly drops that pair. It won't throw; the pair just won't make it into the dictionary. Keep your metadata strings coming from the append node and you're safe.
The second trap is the one hidden in the name. If you go looking for a JSON text output to pipe into a text-display or a REST call, this node won't give you one. It's a dictionary wired to a specific socket, not a serialized blob. If you genuinely need JSON text, you'd convert the dict elsewhere - but for its actual job, getting custom metadata into a saved PNG, it's the simplest tool in the pack.
Worth saying plainly: this is a small utility node in a small, niche pack (the author built it for a model-tester workflow, and it shows - it's tuned for labeling test runs with checkpoint/CFG/sampler tags). For that job it's exactly right: append the tags, convert, save, and every image carries its own settings with it. For anything more ambitious, you'd want a fuller metadata toolkit. But you probably don't need more ambitious.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| metadata | STRING | The appended metadata string from MetaDataAppend format Key1 [Value1]; Key2 [Value2]; Key3 [Value3];... |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| EXTRA_METADATA | EXTRA_METADATA | The metadata formatted as a dictionary/mapping. |