- Clone this repository to your own local / server
git clone git@github.com:mhilmyh/jsonselect.git
- Build your binary from this repository
# this will ouput the jsonselect binary
go build
- Make the jsonselect binary available to your need
# move to /usr/local/ folder
mv ./jsonselect /usr/local/jsonselect
# or you can register it to your PATH variable
# every os / shell has their way, figure it out your self :)
- Use the binary
jsonselect [option] [path]
* option:
-f string
json file
-o string
output file
-p bool
pretty print
* path:
path of json you want to select.
please read more in the gjson repository
here: https://github.com/tidwall/gjson
Here are some examples:
jsonselect data.user_id < user.json
cat user.json | jsonselect data.user_id
jsonselect -f user.json -o user.out data.user_id
jsonselect -f user.json -o user.out -p=true data.user_id