Home United States USA — software Pretty-Print JSON and Move It to the Command Line Pretty-Print JSON and...

Pretty-Print JSON and Move It to the Command Line Pretty-Print JSON and Move It to the Command Line

196
0
SHARE

We discuss how your can create a program in Python, that then executes as a shell command, that allows you to pretty-print your JSON files to your command line.
To this single line, we need to add the argsparse code so that it can take input parameters and add a help function as well.
In this code, I have added the ability to:
That’s pretty much it. There is not much error handling since we don’ t really need a lot of it.
The code is available here .
Converting this script to a command line is a two step process:
To give execute permission to the script, simple run this command:
This will provide execute access only for the user running the command. If you want all users on this system to have the execute permission, issue this command instead:
After it is setup correctly, you can execute it like this.

Continue reading...