JSON can come in all shapes and sizes, and sometimes you want to see it in a structured format that’s easier on the eyes. This is called pretty printing. But how do you accomplish that, especially if you have a really large JSON file? While there are some converter tools online to show json files in a pretty format, they can get very slow and even freeze if your file is too large. Let’s do it locally.
Requirements: Have Python installed, and a terminal environment.
And that’s all there is to it! Python comes built in with a JSON encoding/decoding library, and you can use it to your advantage to get nice formatted output. Alternatively, if you are receiving JSON from an API or HTTP request, you can pipe your results from a curl call directly into this tool as well.
I’ve been keeping a list of things I’ve had to look up for school or work, programming wise, and I thought it might be helpful to list them here. It’s more of a reference than anything, and I know it helps me to look back on it if I forget something little, so maybe someone else will find it useful too.
to execute a premade .sql file
mysql -p -D databasename < file.sql
find/replace in Emacs (discriminately, that is: it will ask you at each instance if you want to replace)
M-x query-replace <ENTER>
space – replace
n – skip
enter – quit
cat a bunch of files together into one
cat file1 file2 > allfiles
cat file* > allfiles
to get unix time in bash
to get unix time in mySQL
rename a table in mySQL
RENAME TABLE oldname TO newname;