Nodes/SP-Nodes/SP_DictValue
ComfyUI Node

SP_DictValue

Pull one field out of a dict without writing a parser node

By bananasss00·Created 2 years ago·Updated 6 days ago· 20
SP_DictValue
  • dictionary
  • *
key

A fair number of nodes in this pack hand you back structured data rather than a single value - the LLM tool nodes, the JSON extractors, anything wrapping an API response. SP_DictValue is the small utility for the next step: reach into that dict and pull out one field by key, instead of writing a custom expression or JSON-parsing node just to get at result["caption"].

How it works

Feed it a dict-shaped object and a key string, and it returns whatever's at that key. It's about as simple as a node gets - no fallback value, no nested-path syntax visible in the schema, just a direct single-level lookup.

Inputs and outputs

  • dictionary (required, any type) - the dict-shaped value to pull from. Typed as * rather than a specific dict type, so ComfyUI won't stop you from feeding it something that isn't actually a dict - that's caught at execution time instead.
  • key (STRING, required, default empty, single-line) - the key to look up.
  • Output: unnamed, typed * - whatever value lives at that key, passed through as-is.

Installing it

ComfyUI Manager: search "SP-Nodes", install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/bananasss00/ComfyUI-SP-Nodes

then restart ComfyUI. No extra dependencies for this node.

Common issues

The key doesn't exist and the node errors instead of returning something graceful. With no visible default_value input in the schema, a missing key is likely to fail the run rather than quietly hand back an empty value - unlike, say, this pack's SP_CacheGet, which explicitly takes a default for exactly this situation. Double-check the key spelling and structure of whatever you're feeding in (print it first with SP_DebugLogger if you're not sure) before assuming the node is broken.

You need a nested field, not a top-level one. The schema only shows a single flat key input - there's nothing here for something like result.data.caption in one step. For nested structures, you'll likely need to chain two SP_DictValue nodes (pull data out first, then caption from that), or reach for whichever of this pack's JSON-specific nodes handles paths more directly if one does.

Wrong output type downstream. Because both dictionary in and the output are wildcard-typed, ComfyUI has no way to warn you at graph-build time that the value at your key is, say, a STRING when the next node expects a FLOAT. That mismatch only shows up when the run actually hits that node - standard territory for any wildcard-typed utility node in this pack, and worth checking first whenever a downstream type error traces back to a dict lookup.

CategorySP-Nodes/Group Nodes

Inputs (2)

NameTypeDefaultDescription
dictionary*
keySTRING

Outputs (1)

NameTypeDescription
**