This is a simple utility website that takes an MTG decklist and exports a Tabletop Simulator compatible JSON file. That's it!
This website is hosted at fateseal.com, but you can also run it locally. All that is necessary is cloning the repository and running the following commands:
$ npm install
$ npm run dev
Then you just need to navigate to localhost:3000
and the app is available to use.
- Download bulk data dump from Scryfall ('All Cards', around 2GB)
- Move into the
processing
directory - Run
bun process.ts
- Move the
processed.json
file into thepublic
directory - Delete the
cards.json
file, and rename theprocessed.json
file tocards.json
I previously used jq
for quick data processing, but switched over to a script using Bun for better readability. It takes a little longer, but is much easier to maintain. Currently, the 2GB bulk data dump gets converted down into a 20MB JSON.
I downloaded Scryfall's bulk dataset of "Unique Cards" as the initial JSON dump to work from. I parsed it down to to size from 187 to about 5mb with jq
:
$ cat "Unique Cards 20240318.json" | jq -c '[.[] | { name: .name, id: .id, imageUrl: .image_uris.large }]' > cards.json
Here's current pipeline:
$ jq '[.[] | select(.legalities.commander == "legal")]' "Unique Artwork 2024.json" > filtered_output.json
$ jq '[.[] | {name, imageUris: .image_uris, allParts: .all_parts, set, collector_number}]' filtered_output.json > slimmed_output.json
$ jq 'reduce .[] as $item ({};
.[$item.name] += {
name: $item.name,
cards: (.[$item.name].cards + { ($item.set + $item.collector_number): { allParts: (if $item.allParts then $item.allParts | map(select(.component != "combo_piece")) else null end), imageUrl: $item.imageUris.large } })
}
) | map(.)' slimmed_output.json > collected_output.json
MTG-related SVGs courtesy of Investigamer/mtg-vectors