AppleScript Unminify JSON file

Posted in AppleScript on October 20, 2016 · 1 min read
Can AppleScript unminify my JSON code? Yes it can!

When learning how to create and manipulate JSON I typically disliked how the JSON file would be minified to one line which seems to go on forever. If you do not want to use a website like Unminify you have the option in the terminal to run a python command that will allow you to unminify the JSON:

python -mjson.tool foo.json bar.json

with foo.json being the minified single line JSON file and bar.json resulting in the un-minified JSON file output. You could always go to Applications > Utilities > Terminal.app or if you are a common user I would hope you have your terminal docked at which you would navigate the terminal where the JSON file is, like on the desktop:

cd Desktop

and you would run the python code mentioned earlier.  After so many instances of opening a terminal or redirecting my terminal to the JSON file location it started to become a multi-step process. My solution to the multi-step process of unminifying the JSON was to create an AppleScript that handled the unminifying process:

and placed in the AppleScript menu bar directory and is executed when I select the script name from the drop down. If you would like to learn how to enable AppleScript in the menu bar check out Show AppleScript icon in the Menu Bar

Help the site go ad free:
Storm Trooper