A `jq` Filter for Card Types from Archidekt JSON Feeds
I'm making my own Magic: The Gathering deck maker. It's based on feeds from Archidekt.
The process I'm doing is to make big collections of cards for each color/color-combination to start with. I filter those down to make actual decks.
My first step was to split things my existing decks into the colors/combos. I did that by pulling down the Archidekt JSON data from their API. Then, I used jq to filter the decks and pull out the names for each set.
Single Color Cards
For example, Green:
| Multi Color
For example, Green and Black for "Golgari"
| I've used jq a few times before. This is the first time I used it to filter things based on values nested inside objects. It's super impressive.
-a
References
Archidekt doesn't mind folks poking at their API. You can use the ID of a deck in a URL like this to get the JSON for it:
The only way to fly when you need to mess with JSON on the command line.