#jq
None of the 14 results on codegolf.se14 results on codegolf.se is about the language. (jq
(and uppercase variants) seems to be frequent statement in Pyth.)
There is jq category on Rosetta Code.
You can try it online but some of examples below need latest version 1.5.
##Task 1: The Tweet
jq is like sed for JSON; you can use it to process structured data with the same ease that sed, awk, grep and friends let you play with text
(Shamelessly twittified the first paragraph from its site.)
##Task 2: The Hello World
bash-4.3$ jq -n -r '"Hello World! This is written in jq."'
Hello World! This is written in jq.
##Task 3: The Odd Numbers
bash-4.3$ jq -R 'split(" ") | range(.[0] | tonumber; .[1] | tonumber + 1) | select(. % 2 == 1)' <<< '20 25'
21
23
25
##Task 4: The Interesting
The ~/.mozilla/firefox/*.default/extensions.json file containing information about the installed Firefox extensions has 0 newlines in 171 Kb on JSON data, which makes it somehow difficult to read.
Pretty print the JSON data:
bash-4.3$ jq '' ~/.mozilla/firefox/*.default/extensions.json
Doh. 8000++ lines are too long, so pass it to pager, but keep the highlighting:
bash-4.3$ jq -C '' ~/.mozilla/firefox/*.default/extensions.json | less -r
Ouch. How many extensions are there anyway?
bash-4.3$ jq '.addons | length' ~/.mozilla/firefox/*.default/extensions.json
58
Ok, but some of them are disabled. How many exactly?
bash-4.3$ jq '[.addons[] | select(.active | not)] | length' ~/.mozilla/firefox/*.default/extensions.json
7
Some of them are quite abandoned and not work with current Firefox anymore:
bash-4.3$ jq -r '.addons[] | [.defaultLocale.name, (.targetApplications[] | select(.id == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"))] | select(.[1].maxVersion | gsub("[^\\d.]"; "") | tonumber < 38.0) | .[0]' ~/.mozilla/firefox/*.default/extensions.json
Unity Desktop Integration
Unity Websites integration
Ubuntu Firefox Modifications
(This later is not true. For some reason extensions.json contains other version ranges than the extensions' install.rdf. But that is not jq's fault anyway.)