Nodes/petty-paint-comfyui-node/Petty Paint Convert
ComfyUI Node

Petty Paint Convert

Any value to a JSON string, one node

By mephisto83·Created 2 years ago·Updated 2 years ago· 3
Petty Paint Convert
  • value
  • data

ComfyUI workflows are full of nodes that produce structured data - dicts, lists, objects - and just as full of nodes that only accept strings. PettyPaintConvert is the adapter in between: feed it any value, get back a JSON string. That's the entire job. json.dumps(value) on one input, STRING on the other.

The name overpromises a little. It's not a general type converter; it serializes whatever you give it to JSON text. So the use cases are exactly the ones where "turn this into text" is the ask: dumping a settings dict or a result object so you can save it, inspect it, or hand it to a text-only node; logging what a workflow actually did; or feeding structured data into a node like the pack's PettyPaintExec that can parse it back. If you've got the pack's hub node outputting a setups JSON string and you want to see what's inside, this is the window.

One thing worth knowing: JSON serialization is strict about types. Tensors, numpy arrays, and other non-JSON-native objects will raise rather than convert. This node is for plain-data values - strings, numbers, dicts, lists, booleans - not for pushing an IMAGE or a MODEL through it and expecting text.

The inputs and outputs

  • value - any type (*), the thing to serialize.
  • Output: data (STRING), the JSON text. Pretty-printing is off, so you get a single compact line.

Installing it

It's in the petty-paint pack:

cd ComfyUI/custom_nodes
git clone https://github.com/mephisto83/petty-paint-comfyui-node

Restart ComfyUI, or install via ComfyUI Manager searching "petty-paint-comfyui-node". Declared dependency: Flask==2.1.2, unused here.

Common issues

The strictness is the trap. If the value contains anything not JSON-serializable - a torch tensor, a numpy array, a set - the node throws at runtime, and the error message can be opaque if the offending value is nested deep in a dict. Keep it to plain data. Also remember it's one-way: this node outputs a string; if you need to go back to structured data, the pack's PettyPaintJsonRead and PettyPaintJsonReadArray handle the reverse. And if all you wanted was str(value) formatting with quotes and escapes left alone, this node's JSON output will add the escaping you didn't ask for - pick the tool to match the need.

CategoryPettyPaint

Inputs (1)

NameTypeDefaultDescription
value*

Outputs (1)

NameTypeDescription
dataSTRING