No description, website, or topics provided.
Go HTML Makefile Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Makefile
README.md
VERSION
app.go
cli-unitw.sh
common_test.go
ex.json
index.html
int_test.md
main.go
selector_test.go
types_test.go
values_test.go
wednesday.json

README.md

Build Status

jsonfilter

jsonfilter is an utility for filtering and selecting values from a json object.

Install

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

examples guaranteed up to date by cli-unit.

wednesday.json

{
	"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"
	]
}

suite: jsonfilter examples

test: should exit 0 when selector is found

when:

cat ./wednesday.json | ./build/output/jsonfilter Address.Street > /dev/null && echo found

then:

found

test: should drill down when using compound selector

when:

cat ./wednesday.json | ./build/output/jsonfilter Address.Street

then:

0001 Cemetery Lane

test: -values should output values in an array

when:

cat ./wednesday.json | ./build/output/jsonfilter -values Hobbies

then:

homicide
playing with her headless Marie Antoinette doll
spiders