Nodes/Crystools/πŸͺ› JSON extractor (BETA)
ComfyUI Node Runs on cloud

πŸͺ› JSON extractor (BETA)

Pull one typed value out of a JSON blob without writing a script

By crystianΒ·Created 3 years agoΒ·Updated 9 months agoΒ· 1,940
πŸͺ› JSON extractor (BETA)
  • json
  • any
  • string
  • int
  • float
  • boolean
β—„keyβ–Ί
β—„defaultβ–Ί

If you've ever had a big JSON blob sitting in your graph - a diff from a comparator node, a config file, whatever - and just wanted one field out of it as a plain number or string you could wire into a sampler, this is the node. It grabs a value out of a JSON object by key and hands it back to you typed, instead of leaving you to eyeball the JSON and hardcode the value yourself.

It's tagged BETA on the node itself, and that's worth taking seriously rather than as decoration - it shipped alongside a JSON file reader in a single changelog entry back in October 2024 and Crystools' author hasn't circled back to harden it since. Don't build a production pipeline around it; do use it for the "I just need this one number out" cases it's clearly meant for.

How it works

You feed it a json input - any JSON-typed value in your graph, most usefully the diff output from Metadata comparator or the json_compared output from JSON comparator, since both of those are typed JSON and chain straight in. Point it at a field with the key input, and it tries to pull that value out and cast it to whatever type you actually need downstream.

The inputs and outputs that matter

  • json (required) - the JSON object to read from.
  • key - which field to pull. Defaults to empty.
  • default - a fallback string used when the key doesn't resolve.

It doesn't make you commit to a type up front. Instead it gives you five outputs simultaneously - any, string, int, float, boolean - and you connect whichever one matches what you're actually after. Wire int into a KSampler's steps, or string into a text field, and ignore the rest.

How to install it

Two ways, same as every node in this pack. Through ComfyUI Manager: search crystools, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/crystian/comfyui-crystools.git
cd comfyui-crystools
pip install -r requirements.txt

Restart ComfyUI and you'll find it under crystools πŸͺ› / Utils - or just double-click the canvas and type "oo", the author's own suggested shortcut for fast-filtering his nodes. No models to download; this whole pack is pure Python/JS plumbing, nothing that touches your GPU for these particular nodes.

Common issues & troubleshooting

The most likely thing to trip you up isn't a bug, it's the type mismatch: if the field you're extracting is a nested object or a list rather than a scalar, none of the five typed outputs are going to give you something clean - this node is built for pulling out a single leaf value (a number, a string, a bool), not restructuring JSON. If a key doesn't exist or the JSON doesn't have the shape you expect, you fall back to whatever you set default to rather than getting an error, which is convenient until it silently produces garbage downstream - worth a "Show any" node parked after it while you're setting things up so you can actually see what came out.

Beyond that, the general Crystools install gotchas apply here too: if the node shows up as "IMPORT FAILED" in the console after an update, it's almost always a missing Python dependency rather than anything wrong with your workflow - reinstalling through Manager or re-running pip install -r requirements.txt clears it. Crystian is the sole maintainer (his own words in the README: "this is my first project in python"), and he's active enough on Reddit under crystian77 to reply to bug reports directly, so if something's genuinely broken it's worth checking his GitHub issues before assuming you did something wrong.

Categorycrystools πŸͺ›/Utils

Inputs (3)

NameTypeDefaultDescription
jsonJSONβ€”
keyoptSTRINGβ€”
defaultoptSTRINGβ€”

Outputs (5)

NameTypeDescription
any*β€”
stringSTRINGβ€”
intINTβ€”
floatFLOATβ€”
booleanBOOLEANβ€”