MTGJSON repository for Magic Cards
Switch branches/tags
Nothing to show
Clone or download
Latest commit a89db5e Nov 7, 2018
Failed to load latest commit information.
build Fixes for some cards with outdated/missing oracle text. (#601) Jul 9, 2018
cron Remove the dependencies on xbase and xutil (#495) Nov 14, 2017
decks Origins clash packs Nov 30, 2015
deploy Visual spoilers for Gatherer sets Nov 17, 2015
json add shared files; unable to build Nov 7, 2018
nginx Added nginx conf files to git repo Oct 8, 2015
sample fix json handling for set.booster Oct 15, 2015
schema check json files and validate against schema (#431) Jul 27, 2017
shared minor fix Nov 7, 2018
util V17 (#540) Jan 21, 2018
verify Remove the dependencies on xbase and xutil (#495) Nov 14, 2017
web Add missing possible card layout value (#623) Oct 4, 2018
.editorconfig Update Travis test environment (#380) Jul 9, 2017
.gitignore UST changes (#509) Dec 2, 2017
.jshintrc V17 (#540) Jan 21, 2018
.travis.yml V17 (#540) Jan 21, 2018
LICENSE Updated license and copyright notices Oct 7, 2015 Create (#524) Jan 10, 2018 readme: show version (#513) Dec 6, 2017
card_links.txt Added a howto.txt file to learn how to update mtgjson Oct 8, 2015 Cache is now compressed locally, saving A LOT of space and possibly s… Oct 13, 2015
howto.txt Add DDT and IMA and rebuild, fix a mistake with Ixalan's set code for… Nov 9, 2017
package-lock.json package updates Nov 7, 2018
package.json package updates Nov 7, 2018 Cache is now compressed locally, saving A LOT of space and possibly s… Oct 13, 2015



This is the code used to generate the JSON for

I didn't plan on open-sourcing this, so there are rough edges. See 'Other' section below.


  • Linux or MacOS (never tested under Windows)
  • Node.js v0.10.0 or later. It will NOT work with 0.9.9 or earlier.


npm install
# See 'Other' below


cd build
node buildSet.js <expansion code>

This creates the file:

json/<expansion code>.json

You will need to run this twice for any 'new' sets. First pass doesn't include foreign langauges.


If something doesn't work after doing a git pull update, make sure you also update NPM modules with

npm update

Including a new set

If you're building mtgjson data on your own, you should follow the following steps to be able to grab the new set data:

  • make sure the new set is already available on gatherer
  • add a file describing the set in shared/set_configs or an appropriate subdirectory
  • node build/buildSet NEWSETCODE
  • check your json files to see if everything is in order
  • node util/updatePrintingsFromSet NEWSETCODE -- This will update the printings on the previous sets, using the data from the new set.
  • node util/updateRulingsFromSet NEWSETCODE -- Same as above, but for rulings.
  • node util/updateLegalitiesFromSet NEWSETCODE -- Same as above, but for legalities.


All gatherer page requests are cached to the cache directory and any future requests will use the cached version instead.

The 'verify' directory is a little private local webpage I use to verify that my JSON is correct by comparing it side by side with card images.

The 'web' directory is used to generate the website.

Note that both verify and web have some symbolic links to files that only exist on my local dev workstation. Sorry.