3 ms·
One really cool tool that web programmers should know if they work with JSON data a lot is jq: http://stedolan.github.io/jq/ http://stedolan.github.io/jq/. It's
by natnat 12y ago
One really cool tool that web programmers should know if they work with JSON data a lot is jq: http://stedolan.github.io/jq/ http://stedolan.github.io/jq/. It's a line-oriented tool like sed, awk, and grep, but it's for manipulating JSON data. It can be really useful for quickly making sense of JSON-formatted log files. For example, you can do something like
jq -c .'select(.server_name == "slow_server") | .end_time - .start_time' < my_log_file
where your log file might look like
'{"server": "slow_server", "timings": {"end_time": 1406611619.90, "start_time": 1406611619.10}}'
to get your web request timings.
Because it's line-oriented, it also works seamlessly with other tools, so you can pipe the output to, say, sort, to find the slowest requests.
- troels 12y agoSomewhat similar to xmlstarlet (http://xmlstar.sourceforge.net/docs.php http://xmlstar.sourceforge.net/docs.php) for xml documents.