3 ms·
Hey guys, I work with JSON on a daily basis on machines that don't have access to jq. My advice to you in similar situations is as follows: To pretty print JSO
by iopuy 10y ago
Hey guys, I work with JSON on a daily basis on machines that don't have access to jq. My advice to you in similar situations is as follows:
To pretty print JSON:
cat myjson.json | python -m json.tool > prettyPrinted.json
To validate json:
cat myjson.json | python -m json.tool
echo $?
If the result is 0 it is well formed and 1 otherwise. You can also pretty print JSON by opening the scratchpad in firefox and clicking the "Pretty print" button.
- dajohnson89 10y agoWhy do you have access to Python, but not jq?
- rhubarbquid 10y agoI would guess: a policy against installing unapproved software on production servers, systems that don't have compilers installed (for security, jq appears to be C code), or debugging on client/customer machines
- scott_karana 10y agoHe might not administer (or have permission to modify) the machine, and Python ships with most distros.