jsonfilter
is an utility for filtering and selecting values from a json object.
download (latest successful build from drone.io) to /usr/local/bin
wget https://drone.io/github.com/benschw/jsonfilter/files/jsonfilter-`uname`-`uname -m`.gz
gunzip jsonfilter-`uname`-`uname -m`.gz
chmod +x jsonfilter-`uname`-`uname -m`
sudo mv jsonfilter-`uname`-`uname -m` /usr/local/bin/jsonfilter
or get the .deb
wget https://drone.io/github.com/benschw/jsonfilter/files/jsonfilter-amd64.deb
sudo dpkg --install jsonfilter.deb
or from the Package Repository (for debian machines like ubuntu)
sudo add-apt-repository "deb http://dl.bintray.com/benschw/deb wheezy main"
sudo apt-get update
sudo apt-get install jsonfilter
examples guaranteed up to date by cli-unit.
{
"Name": "Wednesday",
"Age": 6,
"Parents": [{
"Relation": "father",
"Name": "Gomez"
},{
"Relation": "mother",
"Name": "Morticia"
}],
"Address": {
"Street": "0001 Cemetery Lane",
"City": "New York",
"State": "New York"
},
"Hobbies": [
"homicide",
"playing with her headless Marie Antoinette doll",
"spiders"
]
}
cat ./wednesday.json | ./build/output/jsonfilter Address.Street > /dev/null && echo found
found
cat ./wednesday.json | ./build/output/jsonfilter Address.Street
0001 Cemetery Lane
cat ./wednesday.json | ./build/output/jsonfilter -values Hobbies
homicide
playing with her headless Marie Antoinette doll
spiders