Nodes/ComfyUI_NYJY/JsonDumps(NYJY)
ComfyUI Node

JsonDumps(NYJY)

Turn a JSON object back into a plain string

By aidenli·Created 2 years ago·Updated 4 months ago· 146
JsonDumps(NYJY)
  • json_data
  • result

The pack's JSON logic nodes hand you data as a JSON type - a live Python object (dict or list) riding the wire. That's great for drilling into values with JsonGetValueByKeys, but the moment you want to send that data somewhere that only accepts text - a file saver, a display node, an LLM prompt, an HTTP call - you're holding the wrong type. JsonDumps is the reverse of that: take a JSON input, serialize it back into a JSON-formatted STRING with json.dumps. Name's a Python pun (json dumps = "dump object to string"), and that's exactly what it does.

How it works

One call under the hood: json.dumps(json_data). The dict or list on the input wire becomes its compact, single-line JSON string representation on the output. If you need the other direction - a text JSON parsed back into the JSON type - the pack's sibling JsonLoads node does that; together they're the bookends of a round-trip.

Inputs and outputs

  • json_data - required, type JSON. The object to serialize.
  • Output: result, a STRING of the serialized JSON.

Installing

Standard pack install: ComfyUI Manager → Install via Git URL → https://github.com/aidenli/ComfyUI_NYJY, restart. No extra deps.

Where it fits

The boring-but-real work: you pulled an API response or an LLM's structured output into a JSON object, poked a couple of values out of it, and now you want the whole thing written to a text file alongside your image, or echoed into a prompt for the next LLM call. That's this node. It also makes the "preview the actual JSON" step trivial - feed the output into a text display node and you can finally eyeball the structure.

Two quick notes. The output is compact (no pretty-printing), so don't expect an indented, human-formatted document - if readability is the goal, that's a job for an external viewer. And it only accepts the pack's JSON type, not raw strings - if you're feeding it a string that contains JSON, you want JsonLoads first. Small node, sharp purpose, does the one thing cleanly.

CategoryNYJY/logic

Inputs (1)

NameTypeDefaultDescription
json_dataJSON

Outputs (1)

NameTypeDescription
resultSTRING