3 ms·
Can you do straightforward JSON download and processing in bash?
by Hamuko 6y ago
Can you do straightforward JSON download and processing in bash?
- dylan604 6y agoIs that the sole criteria for a scripting language to be useful?
- heavyset_go 6y agoYou can go a long way with jq, pup and similar tools. As an exercise, I used Bash to build scraping and download scripts for about a dozen websites. I found that I only needed to dip into Python when doing complicated operations on strings, or I needed access to data structures. I actually liked the approach of using Bash first for scraping, because it gave me direct access to Bash's superior IPC and concurrency constructs. I could plug in a Python script into the pipeline and it wouldn't be any different than interacting with another Bash process.
- buddhiajuke 6y agoWith an util like jq, yes.
- samatman 6y agoI do most of my straightforward JSON download and processing in bash. Well, in fish. As everyone else replying to you indicated, I use jq for it. But when I type `curl http://example.com http://example.com | jq .`, I'm programming in fish. Granted, when I want to do something more complex and durable, I'm likely to reach for, yes, python. But nearly as often, I build up a moderately complex jq command, and set an alias to it.
- nnt38 6y agocurl | jq