Nodes/petty-paint-comfyui-node/Petty Paint To Json
ComfyUI Node

Petty Paint To Json

Turn JSON text into something you can actually walk through

By mephisto83·Created 2 years ago·Updated 2 years ago· 3
Petty Paint To Json
    • data
    text

    The petty-paint setup runs on JSON. The iPad app writes a project file, nodes talk to each other with JSON blobs, and if you're building a workflow around it you will eventually be staring at a string that is structured data but refuses to act like it. Petty Paint To Json is the decoder ring: it takes JSON text on one side and hands you the parsed Python object on the other - a dict, a list, whatever was in there - so the pack's PettyPaintJsonRead, PettyPaintJsonMap, and PettyPaintExec nodes (or anything else that accepts any) can actually traverse it.

    How it works

    Under the hood it's one call: json.loads(text). If the input is already not a string - say you're chaining two JSON nodes together - it passes the value through untouched instead of double-parsing. The output is typed as * (any), because the result could be a dictionary, a list, a number, or a nested mix of all three, and ComfyUI can't know until it runs.

    The inputs and outputs that matter

    • text - the JSON string to parse. It's forceInput, so you wire it in from another node rather than typing into the box.

    • data - the parsed object. This is what you feed into the pack's JSON-walking nodes or into any any-typed input downstream.

    One thing to notice: this node does no validation beyond "is this valid JSON." If the string isn't valid JSON, json.loads raises, and your whole queue errors out with a traceback pointing here. That's the most common way people meet this node. If you're parsing data that might be empty or half-written, either guard it upstream or accept that a malformed blob will kill the run - there's no graceful-fallback mode.

    Installing it

    It's part of the petty-paint pack, so you get it with everything else. ComfyUI Manager search "Petty Paint", or:

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

    restart, done. No models, no heavy installs - the pack's only pinned requirement (Flask) isn't even imported by the current source.

    When it bites you

    Beyond invalid JSON, the classic trap is feeding it a plain human-readable prompt instead of JSON - it'll throw immediately, which is at least an honest failure. And keep in mind the output is a live Python object, not a string anymore; if you want to log it or put it in a filename, you'll need to stringify it first (the pack's PettyPaintConvert covers that). Use it to bridge the gap between "text" and "structured data" and it does exactly one job, reliably.

    CategoryPettyPaint

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    data*