INNER CODE UNIT · Python
build
gokayfem/ComfyUI-fal-API · nodes/builder_node.py:644
def build(self, key: str, value: str, value_type: str, chain: str = "") -> tuple[str]:
node = "FalKeyValue"
prior = _parse_chain(node, chain, dict)
merged = {**prior, _require(node, "key", key): _typed_value(node, value, value_type)}
return (json.dumps(merged),)
class FalJSONMerge:
"""Merge two builder outputs: arrays concatenate, objects merge (b wins)."""
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("json",)
FUNCTION = "merge"
CATEGORY = _CATEGORY
DESCRIPTION = (
"Merge two JSON strings: two arrays concatenate (a then b), two objects "
"merge with b overriding a. Useful to combine separately built chains "
"before wiring them into one json field (e.g. two `loras` chains, or "