Some jq
examples translated from https://github.com/jsonlines/guide
jq
can be downloaded from https://stedolan.github.io/jq/download/.
curl https://raw.githubusercontent.com/jsonlines/guide/master/datagov100.json > data.json
$ < data.json jq '.name' | head -n 6
"va-national-formulary"
"safer-company-snapshot-safer-company-snapshot"
"fatality-analysis-reporting-system-fars-ftp-raw-data"
"tiger-line-shapefile-2013-state-alabama-current-county-subdivision-state-based"
"tiger-line-shapefile-2013-state-virginia-current-county-subdivision-state-based"
"national-motor-vehicle-crash-causation-survey-nmvccs-nmvccs-xml-case-viewer"
$ < data.json jq '.organization.name' | head -n 6
"va-gov"
"dot-gov"
"dot-gov"
"census-gov"
"census-gov"
"dot-gov"
$ < data.json jq '.organization.name' | sort | uniq -c | head -n 8
58 "census-gov"
14 "dot-gov"
2 "gsa-gov"
1 "nsf-gov"
8 "opm-gov"
1 "ssa-gov"
11 "usgs-gov"
5 "va-gov"
$ < data.json jq -c '{name: .name, organization: .organization.name }' | head -n 3
{"name":"va-national-formulary","organization":"va-gov"}
{"name":"safer-company-snapshot-safer-company-snapshot","organization":"dot-gov"}
{"name":"fatality-analysis-reporting-system-fars-ftp-raw-data","organization":"dot-gov"}
$ < data.json jq -c '"Notes: " + .notes[0:60] + "..."' | head -n 3
"Notes: The VA National Formulary is a listing of products (drugs an..."
"Notes: The Company Snapshot is a concise electronic record of compa..."
"Notes: The program collects data for analysis of traffic safety cra..."
$ < data.json jq -c 'select(.maintainer) | . + { maintainer: (.maintainer | ascii_upcase) }' | head -n 3 | cut -c1-82
{"license_title":"Creative Commons CCZero","maintainer":"DON LEES","relationships_
{"license_title":"Other License Specified","maintainer":"JAMIE VASSER","relationsh
{"license_title":"U.S. Government Work","maintainer":"LIXIN ZHAO","relationships_a
$ < data.json jq -c 'if .license_id == "cc-zero" then "Open" else "Closed" end' | head -n 3
"Open"
"Closed"
"Closed"