Skip to content

QMK .json Pretty Print Script

mmccoyd edited this page Nov 16, 2022 · 3 revisions

The QMK configurator is an easy way to edit the keymap.json. But if you also want to hand edit the keymap.json, you may want to reformat it away from the configurator's default output of one key per line.

This site's json2hill.py script restores the .json keymap file to a more readable format.

As with anything downloaded from the internet, you should take some steps to assure yourself that the script will not harm your computer nor steal your data. The script is short, so reading it should at least convince you it is rearranging and printing the keymap feed to it, not reading any banking data on disk.

To use the script:

  • Download it somewhere convenient, such as keyboards/handwired/hillside/, or link to it from there.
  • Then feed your downloaded keymap into it and its output into your keymap folder.
$ cd <QMK root folder>
$ ./keyboards/handwired/hillside/json2hill.py --board 52 \
   --input  <download dir>/default.json >\
   ./keyboards/handwired/hillside/52/keymaps/default/keymap.json

You may need to make the script executable with chmod +x.

After your keymap is safely copied and formatted, you may want to remove the keymap from your download directory so later downloads will automatically receive the same file name.