Editing JSON files with Shortcuts and Data Jar

If you visit my links page, you’ll see a bunch of categories with a unique-per-category icon, a category name, and a bunch of links in that category. Each of those categories is generated from its own JSON file. Simple enough.

However, I don’t really want to have to log onto the server, manually edit JSON files, and recompile the site. First of all, directly editing any kind of file like JSON or XML that has tags or characters that are required for it to make sense which can be accidentally deleted is a bad idea. Mistakes get made. Secondly, it’s just easier mentally to view them a different way.

Since I also want to update my git repository after changing something on my site, I like to use shortcuts that will let me download files to edit, or upload new or edited files, and then update my git repositories and compile my site without me having to do anything other than run the shortcut.

In the case of my JSON link files, I decided I could use the TestFlight beta of the upcoming Data Jar, which has excellent Shortcuts support, to edit my JSON files in. To support this, I created a shortcut that lets me choose which categories I want to edit, downloads their files, and shoves the contents into Data Jar, where it can be edited at my convenience.

Then, after editing them in a nice visual editor that won’t let me screw up any important formatting, I can use the same shortcut to push the changes to the server and my git repo and recompile my Hugo generated static site so the changes to my links page are live immediately.

This is the kind of thing I really like Shortcuts for – taking things I do regularly that are either time consuming or have the potential for typos to cause errors, and making them work the same way every time by automating them.